diff options
Diffstat (limited to 'options.c')
-rw-r--r-- | options.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -12,6 +12,7 @@ struct options parse_options(int argc, char **argv) { char **cachetags = malloc(cachetags_cap * sizeof(char*)); char *rootpath = NULL; + char *treeroot = NULL; int print_depth = 1; @@ -25,6 +26,20 @@ struct options parse_options(int argc, char **argv) { } rootpath = strdup(argv[i]); + } else if (strcmp(argv[i], "--treeroot") == 0) { + if (i + 1 >= argc) { + fprintf(stderr, "'--treeroot' takes an argument\n"); + exit(1); + } + + if (treeroot) { + fprintf(stderr, "Multiple tree roots given\n"); + exit(1); + } + treeroot = strdup(argv[i+1]); + + i++; + } else if (strcmp(argv[i], "--exclude") == 0) { if (i + 1 >= argc) { fprintf(stderr, "'--exclude' takes an argument\n"); @@ -89,6 +104,7 @@ struct options parse_options(int argc, char **argv) { .ncachetags = cachetags_len, .cachetags = cachetags, .rootpath = rootpath, + .treeroot = treeroot, .print_depth = print_depth, .debug = debug, }; |