diff options
author | Masatake YAMATO | 2014-04-27 07:18:41 +0200 |
---|---|---|
committer | Karel Zak | 2014-05-06 10:56:52 +0200 |
commit | 1b4d2a4a4aa7df52033d293f26cd4fa79f95578d (patch) | |
tree | 8b32972d8db40f8dc996955819b62f2dd7936b3b /misc-utils/lsblk.c | |
parent | dmesg: add missing include (diff) | |
download | kernel-qcow2-util-linux-1b4d2a4a4aa7df52033d293f26cd4fa79f95578d.tar.gz kernel-qcow2-util-linux-1b4d2a4a4aa7df52033d293f26cd4fa79f95578d.tar.xz kernel-qcow2-util-linux-1b4d2a4a4aa7df52033d293f26cd4fa79f95578d.zip |
lsblk: add -O option to show all available columns
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>
Diffstat (limited to 'misc-utils/lsblk.c')
-rw-r--r-- | misc-utils/lsblk.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index 2efb2ecfb..24853dcf8 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -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; |