diff options
author | Tom Smeding <tom@tomsmeding.com> | 2025-03-10 18:59:40 +0100 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2025-03-10 18:59:40 +0100 |
commit | d1c85b546ae8f8ceaf9ba5962a36f6b6bae5a0a7 (patch) | |
tree | b54168119975df694aacabbacd079a92c7383084 /options.c | |
parent | 39148b1b6dc6c7a10f7e713ece084b6d5cf27537 (diff) |
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, }; |