git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Improve usage messages

From
Petr Baudis <pasky@ucw.cz>
Date
Apr 21, 2005, 16:25 UTC
Message-ID
<20050421162505.GE30991@pasky.ji.cz>
In-Reply-To
<20050421124152.A28137F87D@smurf.noris.de>

Dear diary, on Thu, Apr 21, 2005 at 02:41:52PM CEST, I got a letter where Matthias Urlichs <smurf@smurf.noris.de> told me that...

> This patch adds somewhat-improved usage messages to some of Linus' programs.
> Specifically, they now handle -? / --help.
-? is pretty non-standard. Any problem with going for -h?
Show 11 quoted lines
> Signed-Off-By: Matthias Urlichs <smurf@smurf.noris.de>
> 
> Index: check-files.c
> ===================================================================
> --- 42a073eb6b5bb397a3e8768a032463a7fa02e6b9/check-files.c  (mode:100644 sha1:7d16691aa9d51b5b4670d5837b3527ee7c7da79c)
> +++ 265515f9c4f089b1b61e9d2312c4b3babe189618/check-files.c  (mode:100644 sha1:be904b13659a60eab31787b010a64f2274048a9f)
> @@ -40,6 +40,8 @@
>  {
>  	int i;
>  
> +	if(argc == 2 && (!strcmp(argv[1],"-?") || !strcmp(argv[1],"--help")))

(style-education-hat + if (argc == 2 && (!strcmp(argv[1], "-?") || !strcmp(argv[1], "--help"))) )

> +		usage("check-files filename...");
Let's either do <filename>* or FILE..., this mixing doesn't look good.
Show 14 quoted lines
>  	read_cache();
>  	for (i = 1; i < argc ; i++)
>  		check_file(argv[i]);
> Index: diff-tree.c
> ===================================================================
> --- 42a073eb6b5bb397a3e8768a032463a7fa02e6b9/diff-tree.c  (mode:100644 sha1:b0122e42631410fa579115f025efc3cab777cde6)
> +++ 265515f9c4f089b1b61e9d2312c4b3babe189618/diff-tree.c  (mode:100644 sha1:03fcc2fae2f0b06f3834f0b6e0d8762e70f49f51)
> @@ -193,6 +193,11 @@
>  	}
>  }
>  
> +static const char diff_tree_usage[] = 
> +	"diff-tree [ -r (recurse) | -z (\\0-terminate) ]"
> +		"\n\t<tree sha1> <tree sha1>";

I'd say this is pretty confusnig. Just describe the parameters on folowing lines in more detail, if you must.

Show 5 quoted lines
> +
> +
>  int main(int argc, char **argv)
>  {
>  	unsigned char old[20], new[20];
-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
Previous: Matthias UrlichsNext: David Greaves
Message 2 of 4 in “Improve usage messages”
  1. Improve usage messagesMatthias Urlichs, Apr 21, 2005
  2. Petr BaudisApr 21, 2005
  3. David GreavesApr 21, 2005
  4. Junio C HamanoApr 21, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.