lsirq: add -n option

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2020-03-06 16:26:06 +01:00
parent a0f62b0b20
commit dd52c4fa01
2 changed files with 10 additions and 2 deletions

View File

@ -12,6 +12,9 @@ you should avoid using default outputs in your scripts. Always
explicitly define expected columns by using \fB\-\-output\fR.
.SH OPTIONS
.TP
.BR \-n , " \-\-noheadings
Don't print headings.
.TP
.BR \-o , " \-\-output " \fIlist\fP
Specify which output columns to print. Use \fB\-\-help\fR to get a list of all supported columns.
The default list of columns may be extended if list is specified in the format +list.
@ -21,7 +24,7 @@ Specify sort criteria by column name. See \fB\-\-help\fR output to get column
names.
.TP
.BR \-J , " \-\-json
Update interrupt output every
Use JSON output format.
.TP
.BR \-V ", " \-\-version
Display version information and exit.

View File

@ -60,6 +60,7 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(USAGE_OPTIONS, stdout);
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(_(" -s, --sort <column> specify sort column\n"), stdout);
fputs(USAGE_SEPARATOR, stdout);
@ -79,6 +80,7 @@ int main(int argc, char **argv)
};
static const struct option longopts[] = {
{"sort", required_argument, NULL, 's'},
{"noheadings", no_argument, NULL, 'n'},
{"output", required_argument, NULL, 'o'},
{"json", no_argument, NULL, 'J'},
{"help", no_argument, NULL, 'h'},
@ -90,11 +92,14 @@ int main(int argc, char **argv)
setlocale(LC_ALL, "");
while ((c = getopt_long(argc, argv, "o:s:hJV", longopts, NULL)) != -1) {
while ((c = getopt_long(argc, argv, "no:s:hJV", longopts, NULL)) != -1) {
switch (c) {
case 'J':
out.json = 1;
break;
case 'n':
out.no_headings = 1;
break;
case 'o':
outarg = optarg;
break;