Thread (39 messages) 39 messages, 6 authors, 2025-02-03
STALE522d
Revisions (5)
  1. v1 current
  2. v2 [diff vs current]
  3. v3 [diff vs current]
  4. v4 [diff vs current]
  5. v5 [diff vs current]

[PATCH ethtool-next 14/14] ethtool: Add '-j' support to ethtool

From: Danielle Ratson <hidden>
Date: 2025-01-26 11:57:40
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 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help