]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsblk: add -O option to show all available columns
authorMasatake YAMATO <yamato@redhat.com>
Sun, 27 Apr 2014 05:18:41 +0000 (14:18 +0900)
committerKarel Zak <kzak@redhat.com>
Tue, 6 May 2014 08:56:52 +0000 (10:56 +0200)
Simple command line for gathering information as many as possible is
useful when understanding a system, especially when trouble shooting.

This patch introduces -O option which enables all available columns.

[kzak@redhat.com: - define collisions between options,
                  - define columns when parse argv[]]

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/lsblk.8
misc-utils/lsblk.c

index ea7e7bee84a265ed5e65dffce40d583a7fdc8338..e87689b46a3220b549db9026fca147ba4defb2b0 100644 (file)
@@ -83,6 +83,9 @@ to get a list of all supported columns.
 The default list of columns may be extended if \fIlist\fP is
 specified in the format \fI+list\fP (e.g. \fBlsblk -o +UUID\fP).
 .TP
+.BR \-O , " \-\-output-all "
+Output all available columns.
+.TP
 .BR \-P , " \-\-pairs"
 Produce output in the form of key="value" pairs.
 All potentially unsafe characters are hex-escaped (\\x<code>).
index 2efb2ecfb6d8356888cab361f73e75d6ea20bff8..24853dcf8e2a25bd19a729c9483ac9190979580d 100644 (file)
@@ -1358,6 +1358,7 @@ static void __attribute__((__noreturn__)) help(FILE *out)
        fputs(_(" -m, --perms          output info about permissions\n"), out);
        fputs(_(" -n, --noheadings     don't print headings\n"), out);
        fputs(_(" -o, --output <list>  output columns\n"), out);
+       fputs(_(" -O, --output-all     output all columns\n"), out);
        fputs(_(" -p, --paths          print complete device path\n"), out);
        fputs(_(" -P, --pairs          use key=\"value\" output format\n"), out);
        fputs(_(" -r, --raw            use raw output format\n"), out);
@@ -1399,6 +1400,7 @@ int main(int argc, char *argv[])
                { "discard",    0, 0, 'D' },
                { "help",       0, 0, 'h' },
                { "output",     1, 0, 'o' },
+               { "output-all", 0, 0, 'O' },
                { "perms",      0, 0, 'm' },
                { "noheadings", 0, 0, 'n' },
                { "list",       0, 0, 'l' },
@@ -1417,7 +1419,12 @@ int main(int argc, char *argv[])
        };
 
        static const ul_excl_t excl[] = {       /* rows and cols in in ASCII order */
+               { 'D','O' },
                { 'I','e' },
+               { 'O','S' },
+               { 'O','f' },
+               { 'O','m' },
+               { 'O','t' },
                { 'P','l','r' },
                { 0 }
        };
@@ -1432,7 +1439,7 @@ int main(int argc, char *argv[])
        memset(lsblk, 0, sizeof(*lsblk));
 
        while((c = getopt_long(argc, argv,
-                              "abdDe:fhlnmo:pPiI:rstVS", longopts, NULL)) != -1) {
+                              "abdDe:fhlnmo:OpPiI:rstVS", longopts, NULL)) != -1) {
 
                err_exclusive_options(c, longopts, excl, excl_st);
 
@@ -1468,6 +1475,10 @@ int main(int argc, char *argv[])
                case 'o':
                        outarg = optarg;
                        break;
+               case 'O':
+                       for (ncolumns = 0 ; ncolumns < (int) NCOLS; ncolumns++)
+                               columns[ncolumns] = ncolumns;
+                       break;
                case 'p':
                        lsblk->paths = 1;
                        break;