]>
Commit | Line | Data |
---|---|---|
d0d0a357 AM |
1 | #include "test-tool.h" |
2 | #include "parse-options.h" | |
3 | #include "pathspec.h" | |
d0d0a357 AM |
4 | |
5 | int cmd__parse_pathspec_file(int argc, const char **argv) | |
6 | { | |
7 | struct pathspec pathspec; | |
7ce4088a | 8 | char *pathspec_from_file = NULL; |
d0d0a357 AM |
9 | int pathspec_file_nul = 0, i; |
10 | ||
11 | static const char *const usage[] = { | |
12 | "test-tool parse-pathspec-file --pathspec-from-file [--pathspec-file-nul]", | |
13 | NULL | |
14 | }; | |
15 | ||
16 | struct option options[] = { | |
17 | OPT_PATHSPEC_FROM_FILE(&pathspec_from_file), | |
18 | OPT_PATHSPEC_FILE_NUL(&pathspec_file_nul), | |
19 | OPT_END() | |
20 | }; | |
21 | ||
1437ebf7 | 22 | parse_options(argc, argv, NULL, options, usage, 0); |
d0d0a357 | 23 | |
1437ebf7 | 24 | parse_pathspec_file(&pathspec, 0, 0, NULL, pathspec_from_file, |
d0d0a357 AM |
25 | pathspec_file_nul); |
26 | ||
27 | for (i = 0; i < pathspec.nr; i++) | |
28 | printf("%s\n", pathspec.items[i].original); | |
29 | ||
30 | clear_pathspec(&pathspec); | |
7ce4088a | 31 | free(pathspec_from_file); |
d0d0a357 AM |
32 | return 0; |
33 | } |