Currently, only '--json' flag is supported for JSON output in the
ethtool commands.
Add support for the shorter '-j' flag also.
Signed-off-by: Danielle Ratson <redacted>
---
ethtool.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/ethtool.c b/ethtool.c
index 51c9a46..ae17d49 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -6283,7 +6283,7 @@ static int show_usage(struct cmd_context *ctx __maybe_unused)
fprintf(stdout, "\n");
fprintf(stdout, "FLAGS:\n");
fprintf(stdout, " --debug MASK turn on debugging messages\n");
- fprintf(stdout, " --json enable JSON output format (not supported by all commands)\n");
+ fprintf(stdout, " -j|--json enable JSON output format (not supported by all commands)\n");
fprintf(stdout, " -I|--include-statistics request device statistics related to the command (not supported by all commands)\n");
return 0;
@@ -6539,7 +6539,8 @@ int main(int argc, char **argp)
argc -= 2;
continue;
}
- if (*argp && !strcmp(*argp, "--json")) {
+ if (*argp && (!strcmp(*argp, "--json") ||
+ !strcmp(*argp, "-j"))) {
ctx.json = true;
argp += 1;
argc -= 1;--
2.47.0