diff mbox series

[ethtool-next,3/5] separate FLAGS out in -h

Message ID 20200915235259.457050-4-kuba@kernel.org
State Changes Requested
Delegated to: Michal Kubecek
Headers show
Series pause frame stats | expand

Commit Message

Jakub Kicinski Sept. 15, 2020, 11:52 p.m. UTC
Help output is quite crowded already with every command
being prefixed by --debug and --json options, and we're
about to add a third one.

Add an indirection.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 ethtool.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Jacob Keller Sept. 24, 2020, 12:12 a.m. UTC | #1
On 9/15/2020 4:52 PM, Jakub Kicinski wrote:
> Help output is quite crowded already with every command
> being prefixed by --debug and --json options, and we're
> about to add a third one.
> 
> Add an indirection.
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Seems reasonable to me.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

> ---
>  ethtool.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/ethtool.c b/ethtool.c
> index 23ecfcfd069c..ae5310e9e306 100644
> --- a/ethtool.c
> +++ b/ethtool.c
> @@ -5947,10 +5947,10 @@ static int show_usage(struct cmd_context *ctx __maybe_unused)
>  	fprintf(stdout, PACKAGE " version " VERSION "\n");
>  	fprintf(stdout,
>  		"Usage:\n"
> -		"        ethtool [ --debug MASK ][ --json ] DEVNAME\t"
> +		"        ethtool [ FLAGS ] DEVNAME\t"
>  		"Display standard information about device\n");
>  	for (i = 0; args[i].opts; i++) {
> -		fputs("        ethtool [ --debug MASK ][ --json ] ", stdout);
> +		fputs("        ethtool [ FLAGS ] ", stdout);
>  		fprintf(stdout, "%s %s\t%s\n",
>  			args[i].opts,
>  			args[i].no_dev ? "\t" : "DEVNAME",
> @@ -5959,7 +5959,10 @@ static int show_usage(struct cmd_context *ctx __maybe_unused)
>  			fputs(args[i].xhelp, stdout);
>  	}
>  	nl_monitor_usage();
> -	fprintf(stdout, "Not all options support JSON output\n");
> +	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");
>  

Not really related to this patch, but what is the behavior of a command
when --json is used but it doesn't support it?

Thanks,
Jake

>  	return 0;
>  }
>
diff mbox series

Patch

diff --git a/ethtool.c b/ethtool.c
index 23ecfcfd069c..ae5310e9e306 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -5947,10 +5947,10 @@  static int show_usage(struct cmd_context *ctx __maybe_unused)
 	fprintf(stdout, PACKAGE " version " VERSION "\n");
 	fprintf(stdout,
 		"Usage:\n"
-		"        ethtool [ --debug MASK ][ --json ] DEVNAME\t"
+		"        ethtool [ FLAGS ] DEVNAME\t"
 		"Display standard information about device\n");
 	for (i = 0; args[i].opts; i++) {
-		fputs("        ethtool [ --debug MASK ][ --json ] ", stdout);
+		fputs("        ethtool [ FLAGS ] ", stdout);
 		fprintf(stdout, "%s %s\t%s\n",
 			args[i].opts,
 			args[i].no_dev ? "\t" : "DEVNAME",
@@ -5959,7 +5959,10 @@  static int show_usage(struct cmd_context *ctx __maybe_unused)
 			fputs(args[i].xhelp, stdout);
 	}
 	nl_monitor_usage();
-	fprintf(stdout, "Not all options support JSON output\n");
+	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");
 
 	return 0;
 }