lsmem: add --output-all option

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2018-04-24 21:26:39 +01:00
parent 2ab432effb
commit fcd4bbff87
No known key found for this signature in database
GPG Key ID: A9553245FDE9B739
3 changed files with 12 additions and 1 deletions

View File

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

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;