[PATCH ethtool-next v4 16/16] ethtool: Add '-j' support to ethtool
From: Danielle Ratson <hidden>
Date: 2025-02-05 15:56:00
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Danielle Ratson <hidden>
Date: 2025-02-05 15:56:00
Subsystem:
the rest · Maintainer:
Linus Torvalds
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 8a81001..453058d 100644
--- a/ethtool.c
+++ b/ethtool.c@@ -6303,7 +6303,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;
@@ -6565,7 +6565,8 @@ int main(int argc, char **argp) argc -= 1; continue; } - if (*argp && !strcmp(*argp, "--json")) { + if (*argp && (!strcmp(*argp, "--json") || + !strcmp(*argp, "-j"))) { ctx.json = true; argp += 1; argc -= 1;
--
2.47.0