* 'output-all' of https://github.com/kerolasa/lelux-utiliteetit:
  zramctl: add --output-all option
  swapon: add --output-all option
  rfkill: add --output-all option
  partx: add --output-all option
  lsns: add --output-all option
  lsmem: add --output-all option
  lslogins: add --output-all option
  lslocks: add --output-all option
  lscpu: add --output-all option
  losetup: add --output-all option
  findmnt: add --output-all option
This commit is contained in:
Karel Zak 2018-05-10 12:15:32 +02:00
commit c9fdebcf54
33 changed files with 146 additions and 7 deletions

View File

@ -118,6 +118,7 @@ _findmnt_module()
--notruncate
--options
--output
--output-all
--pairs
--raw
--types

View File

@ -63,6 +63,7 @@ _losetup_module()
--list
--noheadings
--output
--output-all
--raw
--help
--version"

View File

@ -37,6 +37,7 @@ _lscpu_module()
--sysroot
--hex
--physical
--output-all
--help
--version"
COMPREPLY=( $(compgen -W "${OPTS_ALL[*]}" -- $cur) )

View File

@ -36,6 +36,7 @@ _lslocks_module()
--noinaccessible
--noheadings
--output
--output-all
--pid
--raw
--notruncate

View File

@ -59,6 +59,7 @@ _lslogins_module()
--noheadings
--notruncate
--output
--output-all
--pwd
--raw
--system-accs

View File

@ -40,6 +40,7 @@ _lsmem_module()
--bytes
--noheadings
--output
--output-all
--raw
--sysroot
--summary

View File

@ -40,6 +40,7 @@ _lsns_module()
--list
--noheadings
--output
--output-all
--task
--raw
--notruncate

View File

@ -45,6 +45,7 @@ _partx_module()
--noheadings
--nr
--output
--output-all
--pairs
--raw
--sector-size

View File

@ -36,6 +36,7 @@ _rfkill_module()
--json
--noheadings
--output
--output-all
--raw
--help
--version

View File

@ -50,6 +50,7 @@ _swapon_module()
--priority
--summary
--show
--output-all
--noheadings
--raw
--bytes

View File

@ -41,6 +41,7 @@ _zramctl_module()
--find
--noheadings
--output
--output-all
--raw
--reset
--size

View File

@ -106,6 +106,9 @@ or
.B \-\-list
options.
.TP
.B \-\-output\-all
Output all available columns.
.TP
.BR \-P , " \-\-pairs"
List the partitions using the KEY="value" format.
.TP

View File

@ -765,6 +765,7 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(_(" -g, --noheadings don't print headings for --show\n"), out);
fputs(_(" -n, --nr <n:m> specify the range of partitions (e.g. --nr 2:4)\n"), out);
fputs(_(" -o, --output <list> define which output columns to use\n"), out);
fputs(_(" --output-all output all columns\n"), out);
fputs(_(" -P, --pairs use key=\"value\" output format\n"), out);
fputs(_(" -r, --raw use raw output format\n"), out);
fputs(_(" -S, --sector-size <num> overwrite sector size\n"), out);
@ -796,7 +797,8 @@ int main(int argc, char **argv)
unsigned int sector_size = 0;
enum {
OPT_LIST_TYPES = CHAR_MAX + 1
OPT_LIST_TYPES = CHAR_MAX + 1,
OPT_OUTPUT_ALL
};
static const struct option long_opts[] = {
{ "bytes", no_argument, NULL, 'b' },
@ -811,6 +813,7 @@ int main(int argc, char **argv)
{ "list-types", no_argument, NULL, OPT_LIST_TYPES },
{ "nr", required_argument, NULL, 'n' },
{ "output", required_argument, NULL, 'o' },
{ "output-all", no_argument, NULL, OPT_OUTPUT_ALL },
{ "pairs", no_argument, NULL, 'P' },
{ "sector-size",required_argument, NULL, 'S' },
{ "help", no_argument, NULL, 'h' },
@ -858,6 +861,10 @@ int main(int argc, char **argv)
case 'o':
outarg = optarg;
break;
case OPT_OUTPUT_ALL:
for (ncolumns = 0; ncolumns < ARRAY_SIZE(infos); ncolumns++)
columns[ncolumns] = ncolumns;
break;
case 'P':
scols_flags |= PARTX_EXPORT;
what = ACT_SHOW;

View File

@ -67,6 +67,9 @@ Don't truncate output.
.TP
\fB\-o\fR, \fB\-\-output \fIlist\fP
Specify which output columns to print. Use
.TP
.B \-\-output\-all
Output all available columns.
.B \-\-help
to get a list of all supported columns.
.TP

View File

@ -1241,6 +1241,7 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(_(" --noheadings don't print headings\n"), out);
fputs(_(" --notruncate don't truncate output\n"), out);
fputs(_(" -o, --output[=<list>] define the columns to output\n"), out);
fputs(_(" --output-all output all columns\n"), out);
fputs(_(" -p, --pwd display information related to login by password.\n"), out);
fputs(_(" -r, --raw display in raw mode\n"), out);
fputs(_(" -s, --system-accs display system accounts\n"), out);
@ -1277,6 +1278,7 @@ int main(int argc, char *argv[])
OPT_NOTRUNC,
OPT_NOHEAD,
OPT_TIME_FMT,
OPT_OUTPUT_ALL,
};
static const struct option longopts[] = {
@ -1292,6 +1294,7 @@ int main(int argc, char *argv[])
{ "notruncate", no_argument, 0, OPT_NOTRUNC },
{ "noheadings", no_argument, 0, OPT_NOHEAD },
{ "output", required_argument, 0, 'o' },
{ "output-all", no_argument, 0, OPT_OUTPUT_ALL },
{ "last", no_argument, 0, 'L', },
{ "raw", no_argument, 0, 'r' },
{ "system-accs", no_argument, 0, 's' },
@ -1385,6 +1388,10 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
opt_o = 1;
break;
case OPT_OUTPUT_ALL:
for (ncolumns = 0; (size_t)ncolumns < ARRAY_SIZE(coldescs); ncolumns++)
columns[ncolumns] = ncolumns;
break;
case 'r':
outmode = OUT_RAW;
break;

View File

@ -150,6 +150,11 @@ options are not specified.
The default list of columns may be extended if \fIlist\fP is
specified in the format \fI+list\fP (e.g. \fBfindmnt \-o +PROPAGATION\fP).
.TP
.B \-\-output\-all
Output almost all available columns. The columns that require
.B \-\-poll
are not included.
.TP
.BR \-P , " \-\-pairs"
Use key="value" output format. All potentially unsafe characters are hex-escaped (\\x<code>).
.TP

View File

@ -1227,6 +1227,7 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(_(" -n, --noheadings don't print column headings\n"), out);
fputs(_(" -O, --options <list> limit the set of filesystems by mount options\n"), out);
fputs(_(" -o, --output <list> the output columns to be shown\n"), out);
fputs(_(" --output-all output all available columns\n"), out);
fputs(_(" -P, --pairs use key=\"value\" output format\n"), out);
fputs(_(" -R, --submounts print all submounts for the matching filesystems\n"), out);
fputs(_(" -r, --raw use raw output format\n"), out);
@ -1272,7 +1273,8 @@ int main(int argc, char *argv[])
enum {
FINDMNT_OPT_VERBOSE = CHAR_MAX + 1,
FINDMNT_OPT_TREE
FINDMNT_OPT_TREE,
FINDMNT_OPT_OUTPUT_ALL
};
static const struct option longopts[] = {
@ -1296,6 +1298,7 @@ int main(int argc, char *argv[])
{ "notruncate", no_argument, NULL, 'u' },
{ "options", required_argument, NULL, 'O' },
{ "output", required_argument, NULL, 'o' },
{ "output-all", no_argument, NULL, FINDMNT_OPT_OUTPUT_ALL },
{ "poll", optional_argument, NULL, 'p' },
{ "pairs", no_argument, NULL, 'P' },
{ "raw", no_argument, NULL, 'r' },
@ -1396,6 +1399,13 @@ int main(int argc, char *argv[])
case 'o':
outarg = optarg;
break;
case FINDMNT_OPT_OUTPUT_ALL:
for (ncolumns = 0; ncolumns < ARRAY_SIZE(infos); ncolumns++) {
if (is_tabdiff_column(ncolumns))
continue;
columns[ncolumns] = ncolumns;
}
break;
case 'O':
set_match(COL_OPTIONS, optarg);
break;

View File

@ -40,6 +40,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. \fBlslocks -o +BLOCKER\fP).
.TP
.B \-\-output\-all
Output all available columns.
.TP
.BR \-p , " \-\-pid " \fIpid\fP
Display only the locks held by the process with this \fIpid\fR.
.TP

View File

@ -536,6 +536,7 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(_(" -i, --noinaccessible ignore locks without read permissions\n"), out);
fputs(_(" -n, --noheadings don't print headings\n"), out);
fputs(_(" -o, --output <list> define which output columns to use\n"), out);
fputs(_(" --output-all output all columns\n"), out);
fputs(_(" -p, --pid <pid> display only locks held by this process\n"), out);
fputs(_(" -r, --raw use the raw output format\n"), out);
fputs(_(" -u, --notruncate don't truncate text in columns\n"), out);
@ -558,12 +559,16 @@ int main(int argc, char *argv[])
int c, rc = 0;
struct list_head locks;
char *outarg = NULL;
enum {
OPT_OUTPUT_ALL = CHAR_MAX + 1
};
static const struct option long_opts[] = {
{ "bytes", no_argument, NULL, 'b' },
{ "json", no_argument, NULL, 'J' },
{ "pid", required_argument, NULL, 'p' },
{ "help", no_argument, NULL, 'h' },
{ "output", required_argument, NULL, 'o' },
{ "output-all", no_argument, NULL, OPT_OUTPUT_ALL },
{ "notruncate", no_argument, NULL, 'u' },
{ "version", no_argument, NULL, 'V' },
{ "noheadings", no_argument, NULL, 'n' },
@ -603,6 +608,10 @@ int main(int argc, char *argv[])
case 'o':
outarg = optarg;
break;
case OPT_OUTPUT_ALL:
for (ncolumns = 0; ncolumns < ARRAY_SIZE(infos); ncolumns++)
columns[ncolumns] = ncolumns;
break;
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;

View File

@ -145,6 +145,9 @@ print info about all devices. See also \fB\-\-output\fP, \fB\-\-noheadings\fP,
Specify the columns that are to be printed for the \fB\-\-list\fP output.
Use \fB\-\-help\fR to get a list of all supported columns.
.TP
.B \-\-output\-all
Output all available columns.
.TP
.BR \-n , " \-\-noheadings"
Don't print headings for \fB\-\-list\fP output format.
.IP "\fB\-\-raw\fP"

View File

@ -430,6 +430,7 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(_(" -l, --list list info about all or specified (default)\n"), out);
fputs(_(" -n, --noheadings don't print headings for --list output\n"), out);
fputs(_(" -O, --output <cols> specify columns to output for --list\n"), out);
fputs(_(" --output-all output all columns\n"), out);
fputs(_(" --raw use raw --list output format\n"), out);
fputs(USAGE_SEPARATOR, out);
@ -590,7 +591,8 @@ int main(int argc, char **argv)
OPT_SIZELIMIT = CHAR_MAX + 1,
OPT_SHOW,
OPT_RAW,
OPT_DIO
OPT_DIO,
OPT_OUTPUT_ALL
};
static const struct option longopts[] = {
{ "all", no_argument, NULL, 'a' },
@ -607,6 +609,7 @@ int main(int argc, char **argv)
{ "noheadings", no_argument, NULL, 'n' },
{ "offset", required_argument, NULL, 'o' },
{ "output", required_argument, NULL, 'O' },
{ "output-all", no_argument, NULL, OPT_OUTPUT_ALL },
{ "sizelimit", required_argument, NULL, OPT_SIZELIMIT },
{ "partscan", no_argument, NULL, 'P' },
{ "read-only", no_argument, NULL, 'r' },
@ -701,6 +704,10 @@ int main(int argc, char **argv)
outarg = optarg;
list = 1;
break;
case OPT_OUTPUT_ALL:
for (ncolumns = 0; ncolumns < ARRAY_SIZE(infos); ncolumns++)
columns[ncolumns] = ncolumns;
break;
case 'P':
lo_flags |= LO_FLAGS_PARTSCAN;
break;

View File

@ -161,6 +161,10 @@ The CPU logical numbers are not affected by this option.
.TP
.BR \-V , " \-\-version"
Display version information and exit.
.TP
.B \-\-output\-all
Output all available columns. This option must be combined with either
.BR \-\-extended " or " \-\-parse .
.SH BUGS
The basic overview of CPU family, model, etc. is always based on the first
CPU only.

View File

@ -1935,6 +1935,9 @@ int main(int argc, char *argv[])
int cpu_modifier_specified = 0;
size_t setsize;
enum {
OPT_OUTPUT_ALL = CHAR_MAX + 1,
};
static const struct option longopts[] = {
{ "all", no_argument, NULL, 'a' },
{ "online", no_argument, NULL, 'b' },
@ -1947,6 +1950,7 @@ int main(int argc, char *argv[])
{ "physical", no_argument, NULL, 'y' },
{ "hex", no_argument, NULL, 'x' },
{ "version", no_argument, NULL, 'V' },
{ "output-all", no_argument, NULL, OPT_OUTPUT_ALL },
{ NULL, 0, NULL, 0 }
};
@ -2011,6 +2015,13 @@ int main(int argc, char *argv[])
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case OPT_OUTPUT_ALL:
{
size_t sz;
for (sz = 0; sz < ARRAY_SIZE(coldescs); sz++)
columns[sz] = 1;
break;
}
default:
errtryhelp(EXIT_FAILURE);
}

View File

@ -57,6 +57,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 \fB+\fIlist\fP (e.g. \fBlsmem \-o +NODE\fP).
.TP
.B \-\-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>).

View File

@ -498,6 +498,7 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(_(" -b, --bytes print SIZE in bytes rather than in human readable format\n"), out);
fputs(_(" -n, --noheadings don't print headings\n"), out);
fputs(_(" -o, --output <list> output columns\n"), out);
fputs(_(" --output-all output all columns\n"), out);
fputs(_(" -r, --raw use raw output format\n"), out);
fputs(_(" -S, --split <list> split ranges by specified columns\n"), out);
fputs(_(" -s, --sysroot <dir> use the specified directory as system root\n"), out);
@ -527,7 +528,8 @@ int main(int argc, char **argv)
size_t i;
enum {
LSMEM_OPT_SUMARRY = CHAR_MAX + 1
LSMEM_OPT_SUMARRY = CHAR_MAX + 1,
OPT_OUTPUT_ALL
};
static const struct option longopts[] = {
@ -537,6 +539,7 @@ int main(int argc, char **argv)
{"json", no_argument, NULL, 'J'},
{"noheadings", no_argument, NULL, 'n'},
{"output", required_argument, NULL, 'o'},
{"output-all", no_argument, NULL, OPT_OUTPUT_ALL},
{"pairs", no_argument, NULL, 'P'},
{"raw", no_argument, NULL, 'r'},
{"sysroot", required_argument, NULL, 's'},
@ -581,6 +584,10 @@ int main(int argc, char **argv)
case 'o':
outarg = optarg;
break;
case OPT_OUTPUT_ALL:
for (ncolumns = 0; (size_t)ncolumns < ARRAY_SIZE(coldescs); ncolumns++)
columns[ncolumns] = ncolumns;
break;
case 'P':
lsmem->export = 1;
lsmem->want_summary = 0;

View File

@ -51,6 +51,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 \fB+\fIlist\fP (e.g. \fBlsns \-o +PATH\fP).
.TP
.B \-\-output\-all
Output all available columns.
.TP
.BR \-p , " \-\-task " \fIpid\fP
Display only the namespaces held by the process with this \fIpid\fR.
.TP

View File

@ -906,6 +906,7 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(_(" -l, --list use list format output\n"), out);
fputs(_(" -n, --noheadings don't print headings\n"), out);
fputs(_(" -o, --output <list> define which output columns to use\n"), out);
fputs(_(" --output-all output all columns\n"), out);
fputs(_(" -p, --task <pid> print process namespaces\n"), out);
fputs(_(" -r, --raw use the raw output format\n"), out);
fputs(_(" -u, --notruncate don't truncate text in columns\n"), out);
@ -931,11 +932,15 @@ int main(int argc, char *argv[])
int c;
int r = 0;
char *outarg = NULL;
enum {
OPT_OUTPUT_ALL = CHAR_MAX + 1
};
static const struct option long_opts[] = {
{ "json", no_argument, NULL, 'J' },
{ "task", required_argument, NULL, 'p' },
{ "help", no_argument, NULL, 'h' },
{ "output", required_argument, NULL, 'o' },
{ "output-all", no_argument, NULL, OPT_OUTPUT_ALL },
{ "notruncate", no_argument, NULL, 'u' },
{ "version", no_argument, NULL, 'V' },
{ "noheadings", no_argument, NULL, 'n' },
@ -980,6 +985,10 @@ int main(int argc, char *argv[])
case 'o':
outarg = optarg;
break;
case OPT_OUTPUT_ALL:
for (ncolumns = 0; ncolumns < ARRAY_SIZE(infos); ncolumns++)
columns[ncolumns] = ncolumns;
break;
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;

View File

@ -34,6 +34,9 @@ Do not print a header line.
Specify which output columns to print. Use \-\-help to get a list of
available columns.
.TP
.B \-\-output\-all
Output all available columns.
.TP
\fB\-r\fR, \fB\-\-raw\fR
Use the raw output format.
.TP

View File

@ -579,6 +579,7 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(_(" -J, --json use JSON output format\n"), stdout);
fputs(_(" -n, --noheadings don't print headings\n"), stdout);
fputs(_(" -o, --output <list> define which output columns to use\n"), stdout);
fputs(_(" --output-all output all columns\n"), stdout);
fputs(_(" -r, --raw use the raw output format\n"), stdout);
fputs(USAGE_SEPARATOR, stdout);
@ -609,12 +610,16 @@ static void __attribute__((__noreturn__)) usage(void)
int main(int argc, char **argv)
{
struct control ctrl = { 0 };
int c, act = ACT_LIST;
int c, act = ACT_LIST, list_all = 0;
char *outarg = NULL;
enum {
OPT_LIST_TYPES = CHAR_MAX + 1
};
static const struct option longopts[] = {
{ "json", no_argument, NULL, 'J' },
{ "noheadings", no_argument, NULL, 'n' },
{ "output", required_argument, NULL, 'o' },
{ "output-all", no_argument, NULL, OPT_LIST_TYPES },
{ "raw", no_argument, NULL, 'r' },
{ "version", no_argument, NULL, 'V' },
{ "help", no_argument, NULL, 'h' },
@ -644,6 +649,9 @@ int main(int argc, char **argv)
case 'o':
outarg = optarg;
break;
case OPT_LIST_TYPES:
list_all = 1;
break;
case 'r':
ctrl.raw = 1;
break;
@ -690,6 +698,8 @@ int main(int argc, char **argv)
columns[ncolumns++] = COL_ID;
columns[ncolumns++] = COL_TYPE;
columns[ncolumns++] = COL_DEVICE;
if (list_all)
columns[ncolumns++] = COL_DESC;
columns[ncolumns++] = COL_SOFT;
columns[ncolumns++] = COL_HARD;

View File

@ -160,6 +160,9 @@ Display a definable table of swap areas. See the
.B \-\-help
output for a list of available columns.
.TP
.B \-\-output\-all
Output all available columns.
.TP
.B \-\-noheadings
Do not print headings when displaying
.B \-\-show

View File

@ -846,7 +846,8 @@ int main(int argc, char *argv[])
BYTES_OPTION = CHAR_MAX + 1,
NOHEADINGS_OPTION,
RAW_OPTION,
SHOW_OPTION
SHOW_OPTION,
OPT_LIST_TYPES
};
static const struct option long_opts[] = {
@ -861,6 +862,7 @@ int main(int argc, char *argv[])
{ "verbose", no_argument, NULL, 'v' },
{ "version", no_argument, NULL, 'V' },
{ "show", optional_argument, NULL, SHOW_OPTION },
{ "output-all", no_argument, NULL, OPT_LIST_TYPES },
{ "noheadings", no_argument, NULL, NOHEADINGS_OPTION },
{ "raw", no_argument, NULL, RAW_OPTION },
{ "bytes", no_argument, NULL, BYTES_OPTION },
@ -951,6 +953,10 @@ int main(int argc, char *argv[])
}
ctl.show = 1;
break;
case OPT_LIST_TYPES:
for (ctl.ncolumns = 0; (size_t)ctl.ncolumns < ARRAY_SIZE(infos); ctl.ncolumns++)
ctl.columns[ctl.ncolumns] = ctl.ncolumns;
break;
case NOHEADINGS_OPTION:
ctl.no_heading = 1;
break;

View 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

View 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;