Thu, 07 Sep 2017 18:18:30 +0200
adds dav-sync archive command
dav/sync.c | file | annotate | diff | comparison | revisions | |
dav/sync.h | file | annotate | diff | comparison | revisions | |
dav/version.h | file | annotate | diff | comparison | revisions |
--- a/dav/sync.c Tue Sep 05 17:25:09 2017 +0200 +++ b/dav/sync.c Thu Sep 07 18:18:30 2017 +0200 @@ -100,7 +100,9 @@ if(!strcmp(cmd, "pull")) { ret = cmd_pull(args); } else if(!strcmp(cmd, "push")) { - ret = cmd_push(args); + ret = cmd_push(args, FALSE); + } else if(!strcmp(cmd, "archive")) { + ret = cmd_push(args, TRUE); } else if(!strcmp(cmd, "resolve-conflicts")) { ret = cmd_resolve_conflicts(args); } else if(!strcmp(cmd, "delete-conflicts")) { @@ -142,6 +144,7 @@ fprintf(stderr, "Commands:\n"); fprintf(stderr, " pull [-cld] <directory>\n"); fprintf(stderr, " push [-cld] <directory>\n"); + fprintf(stderr, " archive [-cld] <directory>\n"); fprintf(stderr, " resolve-conflicts <directory>\n"); fprintf(stderr, " delete-conflicts <directory>\n"); fprintf(stderr, " trash-info <directory>\n"); @@ -735,7 +738,7 @@ return ucx_map_cstr_get(db->conflict, res->path) ? 1 : 0; } -int cmd_push(CmdArgs *a) { +int cmd_push(CmdArgs *a, DavBool archive) { if(a->argc != 1) { fprintf(stderr, "Too %s arguments\n", a->argc < 1 ? "few" : "many"); return -1; @@ -878,7 +881,7 @@ } // delete all removed files - if(ret == 0) { + if(ret == 0 && !archive) { UcxMapIterator i = ucx_map_iterator(db->resources); LocalResource *local; UCX_MAP_FOREACH(key, local, i) { @@ -935,11 +938,13 @@ char *str_delete = sync_delete == 1 ? "file" : "files"; char *str_skipped = sync_delete == 1 ? "file" : "files"; char *str_error = sync_error == 1 ? "error" : "errors"; - printf("Result: %d %s pushed, %d %s deleted, %d %s skipped, %d %s\n", - sync_success, str_success, - sync_delete,str_delete, - sync_skipped,str_skipped, - sync_error, str_error); + + printf("Result: %d %s pushed, ", sync_success, str_success); + if(!archive) { + printf("%d %s deleted, ", sync_delete, str_delete); + } + printf("%d %s skipped, %d %s\n", + sync_skipped, str_skipped, sync_error, str_error); } return ret;