From: Thomas Weißschuh Date: Mon, 3 Jul 2023 15:55:40 +0000 (+0200) Subject: lsclocks: add --output-all X-Git-Tag: v2.40-rc1~346^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9f59d21caad63434ac860cc55a3652825be07366;p=thirdparty%2Futil-linux.git lsclocks: add --output-all Signed-off-by: Thomas Weißschuh --- diff --git a/bash-completion/lsclocks b/bash-completion/lsclocks index bd81d88bc2..6048323c95 100644 --- a/bash-completion/lsclocks +++ b/bash-completion/lsclocks @@ -15,6 +15,9 @@ _lsclocks_module() '-o'|'--output') return 0 ;; + '--output-all') + return 0 + ;; '-r'|'--raw') return 0 ;; @@ -32,6 +35,7 @@ _lsclocks_module() OPTS="--json --noheadings --output + --output-all --raw --time --help diff --git a/misc-utils/lsclocks.1.adoc b/misc-utils/lsclocks.1.adoc index 5c7f5eac43..1eb8b952a7 100644 --- a/misc-utils/lsclocks.1.adoc +++ b/misc-utils/lsclocks.1.adoc @@ -33,6 +33,9 @@ Don't print headings. Specify which output columns to print. See the *OUTPUT COLUMNS* section for details of available columns. +*--output-all*:: +Output all columns. + *-r*, *--raw*:: Use raw output format. diff --git a/misc-utils/lsclocks.c b/misc-utils/lsclocks.c index 8531e9fe32..b15e69cf3e 100644 --- a/misc-utils/lsclocks.c +++ b/misc-utils/lsclocks.c @@ -146,6 +146,7 @@ static void __attribute__((__noreturn__)) usage(void) fputs(_(" -J, --json use JSON output format\n"), out); fputs(_(" -n, --noheadings don't print headings\n"), out); fputs(_(" -o, --output output columns\n"), out); + fputs(_(" --output-all output all columns\n"), out); fputs(_(" -r, --raw use raw output format\n"), out); fputs(_(" -t, --time show current time of single clock\n"), out); @@ -208,8 +209,7 @@ static clockid_t parse_clock(const char *name) int main(int argc, char **argv) { size_t i, j; - char c; - int rc; + int c, rc; const struct colinfo *colinfo; const struct clockinfo *clockinfo; @@ -226,9 +226,13 @@ int main(int argc, char **argv) struct timespec resolution, now; char buf[FORMAT_TIMESTAMP_MAX]; + enum { + OPT_OUTPUT_ALL = CHAR_MAX + 1 + }; static const struct option longopts[] = { { "noheadings", no_argument, NULL, 'n' }, { "output", required_argument, NULL, 'o' }, + { "output-all", no_argument, NULL, OPT_OUTPUT_ALL }, { "version", no_argument, NULL, 'V' }, { "help", no_argument, NULL, 'h' }, { "json", no_argument, NULL, 'J' }, @@ -250,6 +254,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 'J': json = true; break;