#include "command.h" #include "commands.h" #include "digest/digest.h" #include "version.h" #include "l2su.h" #include "macros.h" #include #include unsigned cmd_version_list_remote(struct l2_context_node *ctx, char **args) { unsigned res; L2_UNUSED(ctx); if (*args) { CMD_FATAL(CMD_MSG_UNKNOWN_ARGUMENT, *args); } res = l2_version_load_remote(); if (res != VERSION_SUCCESS) { CMD_FATAL("Failed to load versions: %s", l2_version_strerror(res)); } for (struct l2_version_remote *rv = l2_state.ver_remote_head; rv; rv = rv->next) { printf("%s\n", rv->id); } return CMD_RESULT_SUCCESS; } unsigned cmd_version_list_local(struct l2_context_node *ctx, char **args) { return CMD_RESULT_SUCCESS; } unsigned l2_version_download_libraries(json_t *jlibraries, l2_version_feature_match_proc_t *feature_matcher); bool feat_match_cb(const char *name, json_t *js) { L2_UNUSED(name); L2_UNUSED(js); return false; } unsigned cmd_version_install(struct l2_context_node *ctx, char **args) { unsigned res = l2_version_load_remote(); if (res != VERSION_SUCCESS) { CMD_FATAL("failed to load versions: %s", l2_version_strerror(res)); } json_t *js; res = l2_version_load_local(*args, &js); if (res != VERSION_SUCCESS) { CMD_FATAL("failed to load 1.8.9: %s", l2_version_strerror(res)); } json_dumpf(js, stdout, JSON_INDENT(4)); putchar('\n'); printf("%s\n", l2_version_strerror(l2_version_download_libraries(json_object_get(js, "libraries"), &feat_match_cb))); json_decref(js); return CMD_RESULT_SUCCESS; }