]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
zramctl: add --output-all option
authorSami Kerola <kerolasa@iki.fi>
Tue, 24 Apr 2018 21:18:54 +0000 (22:18 +0100)
committerSami Kerola <kerolasa@iki.fi>
Thu, 3 May 2018 18:56:21 +0000 (19:56 +0100)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
bash-completion/zramctl
sys-utils/zramctl.8
sys-utils/zramctl.c

index 31e3c76a629499d54c720b498f9f3dba494f4b52..5274a561ec7b424abdba4bcb16038386fcf0b140 100644 (file)
@@ -41,6 +41,7 @@ _zramctl_module()
                                --find
                                --noheadings
                                --output
+                               --output-all
                                --raw
                                --reset
                                --size
index 679a8a175704cc1873e327929ce7bdf3fb8d283b..ccfb8901ddf9e7394a91973b64ac4793cc33f03a 100644 (file)
@@ -59,6 +59,9 @@ Define the status output columns to be used.  If no output arrangement is
 specified, then a default set is used.
 Use \fB\-\-help\fP to get a list of all supported columns.
 .TP
+.B \-\-output\-all
+Output all available columns.
+.TP
 .B \-\-raw
 Use the raw format for status output.
 .TP
index 8da7b2ddb392d6f817ffcabcd2899ab7489eaeb9..4d900f11907b22e075c393c67f6a74a8c7aded33 100644 (file)
@@ -543,6 +543,7 @@ static void __attribute__((__noreturn__)) usage(void)
        fputs(_(" -f, --find                find a free device\n"), out);
        fputs(_(" -n, --noheadings          don't print headings\n"), out);
        fputs(_(" -o, --output <list>       columns to use for status output\n"), out);
+       fputs(_("     --output-all          output all columns\n"), out);
        fputs(_("     --raw                 use raw status output format\n"), out);
        fputs(_(" -r, --reset               reset all specified devices\n"), out);
        fputs(_(" -s, --size <size>         device size\n"), out);
@@ -575,7 +576,10 @@ int main(int argc, char **argv)
        int rc = 0, c, find = 0, act = A_NONE;
        struct zram *zram = NULL;
 
-       enum { OPT_RAW = CHAR_MAX + 1 };
+       enum {
+               OPT_RAW = CHAR_MAX + 1,
+               OPT_LIST_TYPES
+       };
 
        static const struct option longopts[] = {
                { "algorithm", required_argument, NULL, 'a' },
@@ -583,6 +587,7 @@ int main(int argc, char **argv)
                { "find",      no_argument, NULL, 'f' },
                { "help",      no_argument, NULL, 'h' },
                { "output",    required_argument, NULL, 'o' },
+               { "output-all",no_argument, NULL, OPT_LIST_TYPES },
                { "noheadings",no_argument, NULL, 'n' },
                { "reset",     no_argument, NULL, 'r' },
                { "raw",       no_argument, NULL, OPT_RAW },
@@ -625,6 +630,10 @@ int main(int argc, char **argv)
                        if (ncolumns < 0)
                                return EXIT_FAILURE;
                        break;
+               case OPT_LIST_TYPES:
+                       for (ncolumns = 0; (size_t)ncolumns < ARRAY_SIZE(infos); ncolumns++)
+                               columns[ncolumns] = ncolumns;
+                       break;
                case 's':
                        size = strtosize_or_err(optarg, _("failed to parse size"));
                        act = A_CREATE;