From: Sami Kerola Date: Tue, 24 Apr 2018 20:47:26 +0000 (+0100) Subject: rfkill: add --output-all option X-Git-Tag: v2.33-rc1~274^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4dfd172dd8e42d060023440cfe5af9ab42b14464;p=thirdparty%2Futil-linux.git rfkill: add --output-all option Signed-off-by: Sami Kerola --- diff --git a/bash-completion/rfkill b/bash-completion/rfkill index 2d561e955d..4643666e29 100644 --- a/bash-completion/rfkill +++ b/bash-completion/rfkill @@ -36,6 +36,7 @@ _rfkill_module() --json --noheadings --output + --output-all --raw --help --version diff --git a/sys-utils/rfkill.8 b/sys-utils/rfkill.8 index 3c30c8cedc..9eff913b8a 100644 --- a/sys-utils/rfkill.8 +++ b/sys-utils/rfkill.8 @@ -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 diff --git a/sys-utils/rfkill.c b/sys-utils/rfkill.c index 57e1dddab0..d87815a258 100644 --- a/sys-utils/rfkill.c +++ b/sys-utils/rfkill.c @@ -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 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;