]> wimlib.net Git - wimlib/commitdiff
wimdir: Add --one-file-only option
authorEric Biggers <ebiggers3@gmail.com>
Thu, 16 Jan 2014 01:42:47 +0000 (19:42 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Thu, 16 Jan 2014 01:42:47 +0000 (19:42 -0600)
doc/imagex-dir.1.in
programs/imagex.c

index e0f49c468aa8564baef33e81e0ed5671a7438147..38a578a6da460eaadc8e293efafd43144f2a30ad 100644 (file)
@@ -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.
index f795ded78c0bd9f5de27def77750c96c78e0b93d..990a41e54781abcce94abc9cd652f42170defb5d 100644 (file)
@@ -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);