From: Eric Biggers Date: Thu, 16 Jan 2014 01:42:47 +0000 (-0600) Subject: wimdir: Add --one-file-only option X-Git-Tag: v1.6.1~28 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=8803b22e0ffd02c50e353b58a4987761e593cdc9 wimdir: Add --one-file-only option --- diff --git a/doc/imagex-dir.1.in b/doc/imagex-dir.1.in index e0f49c46..38a578a6 100644 --- a/doc/imagex-dir.1.in +++ b/doc/imagex-dir.1.in @@ -22,6 +22,10 @@ root directory. .TP \fB--detailed\fR List detailed information about each file. +.TP +\fB--one-file-only\fR +Show information about one file only. Intended for use with both \fB--path\fR +and \fB--detailed\fR. .SH NOTES \fB@IMAGEX_PROGNAME@ dir\fR supports split WIMs, but it will only work on the first part of the split WIM. diff --git a/programs/imagex.c b/programs/imagex.c index f795ded7..990a41e5 100644 --- a/programs/imagex.c +++ b/programs/imagex.c @@ -146,6 +146,7 @@ enum { IMAGEX_NOCHECK_OPTION, IMAGEX_NO_ACLS_OPTION, IMAGEX_NO_WILDCARDS_OPTION, + IMAGEX_ONE_FILE_ONLY_OPTION, IMAGEX_NOT_PIPABLE_OPTION, IMAGEX_PACK_CHUNK_SIZE_OPTION, IMAGEX_PACK_STREAMS_OPTION, @@ -232,6 +233,7 @@ static const struct option delete_options[] = { static const struct option dir_options[] = { {T("path"), required_argument, NULL, IMAGEX_PATH_OPTION}, {T("detailed"), no_argument, NULL, IMAGEX_DETAILED_OPTION}, + {T("one-file-only"), no_argument, NULL, IMAGEX_ONE_FILE_ONLY_OPTION}, {NULL, 0, NULL, 0}, }; @@ -2584,6 +2586,7 @@ imagex_dir(int argc, tchar **argv, int cmd) struct print_dentry_options options = { .detailed = false, }; + int iterate_flags = WIMLIB_ITERATE_DIR_TREE_FLAG_RECURSIVE; for_opt(c, dir_options) { switch (c) { @@ -2593,6 +2596,9 @@ imagex_dir(int argc, tchar **argv, int cmd) case IMAGEX_DETAILED_OPTION: options.detailed = true; break; + case IMAGEX_ONE_FILE_ONLY_OPTION: + iterate_flags &= ~WIMLIB_ITERATE_DIR_TREE_FLAG_RECURSIVE; + break; default: goto out_usage; } @@ -2636,8 +2642,7 @@ imagex_dir(int argc, tchar **argv, int cmd) image = 1; } - ret = wimlib_iterate_dir_tree(wim, image, path, - WIMLIB_ITERATE_DIR_TREE_FLAG_RECURSIVE, + ret = wimlib_iterate_dir_tree(wim, image, path, iterate_flags, print_dentry, &options); out_wimlib_free: wimlib_free(wim);