Skip to content

Commit

Permalink
lscpu: add --output-all option
Browse files Browse the repository at this point in the history
Signed-off-by: Sami Kerola <[email protected]>
  • Loading branch information
kerolasa committed May 3, 2018
1 parent 289673b commit fbf0619
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions bash-completion/lscpu
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ _lscpu_module()
--sysroot
--hex
--physical
--output-all
--help
--version"
COMPREPLY=( $(compgen -W "${OPTS_ALL[*]}" -- $cur) )
Expand Down
4 changes: 4 additions & 0 deletions sys-utils/lscpu.1
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 11 additions & 0 deletions sys-utils/lscpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,9 @@ int main(int argc, char *argv[])
int columns[ARRAY_SIZE(coldescs)], ncolumns = 0;
int cpu_modifier_specified = 0;

enum {
OPT_OUTPUT_ALL = CHAR_MAX + 1,
};
static const struct option longopts[] = {
{ "all", no_argument, NULL, 'a' },
{ "online", no_argument, NULL, 'b' },
Expand All @@ -1944,6 +1947,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 }
};

Expand Down Expand Up @@ -2008,6 +2012,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);
}
Expand Down

0 comments on commit fbf0619

Please sign in to comment.