Sun, 17 Dec 2023 15:03:01 +0100
remove list_repositories() config.c function in favor of a cmd_list_repositories() function in main.c
dav/config.c | file | annotate | diff | comparison | revisions | |
dav/config.h | file | annotate | diff | comparison | revisions | |
dav/main.c | file | annotate | diff | comparison | revisions | |
dav/main.h | file | annotate | diff | comparison | revisions |
--- a/dav/config.c Sun Dec 17 14:25:34 2023 +0100 +++ b/dav/config.c Sun Dec 17 15:03:01 2023 +0100 @@ -228,16 +228,6 @@ return k; } -int list_repositories(void) { - if(!davconfig) { - return 1; - } - for(DavCfgRepository *repo=davconfig->repositories;repo;repo=repo->next) { - printf("%.*s\n", (int)repo->name.value.length, repo->name.value.ptr); - } - return 0; -} - static char* get_attr_content(xmlNode *node) { // TODO: remove code duplication (util_xml_get_text) while(node) {
--- a/dav/config.h Sun Dec 17 14:25:34 2023 +0100 +++ b/dav/config.h Sun Dec 17 15:03:01 2023 +0100 @@ -59,8 +59,6 @@ cxmutstr load_key_file(const char *filename); -int list_repositories(void); - PwdStore* get_pwdstore(void); int pwdstore_save(PwdStore *pwdstore);
--- a/dav/main.c Sun Dec 17 14:25:34 2023 +0100 +++ b/dav/main.c Sun Dec 17 15:03:01 2023 +0100 @@ -223,7 +223,7 @@ ret = cmd_remove_repository(args); } else if(!strcasecmp(cmd, "list-repositories") || !strcasecmp(cmd, "list-repos")) { - ret = list_repositories(); + ret = cmd_list_repositories(); } else if(!strcasecmp(cmd, "repository-url") || !strcasecmp(cmd, "repo-url")) { ret = cmd_repository_url(args); @@ -2502,6 +2502,17 @@ } } +int cmd_list_repositories(void) { + DavConfig *config = get_config(); + if(!config) { + return 1; + } + for(DavCfgRepository *repo=config->repositories;repo;repo=repo->next) { + printf("%.*s\n", (int)repo->name.value.length, repo->name.value.ptr); + } + return 0; +} + int cmd_repository_url(CmdArgs *args) { if(args->argc != 1) { fprintf(stderr, "Too few arguments\n");