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

Re: [PATCH] difftool: print list of valid tools with '--tool-help'

From
David Aguilar <davvid@gmail.com>
Date
Mar 17, 2012, 03:31 UTC
Message-ID
<CAJDDKr4bevWPjvQVLiWYm_6LxiHObms+i2QfeKKJB2g4eF6RnA@mail.gmail.com>
In-Reply-To
<7vk42lijfu.fsf@alter.siamese.dyndns.org>
On Thu, Mar 15, 2012 at 3:32 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 21 quoted lines
> Tim Henigan <tim.henigan@gmail.com> writes:
>
>> @@ -100,6 +101,15 @@ sub generate_command
>>               if ($arg eq '-h') {
>>                       usage();
>>               }
>> +             if ($arg eq '--tool-help') {
>> +                     my $gitpath = Git::exec_path();
>> +                     print "'git difftool --tool=<tool>' may be set to one of the following:\n";
>> +                     for (glob "$gitpath/mergetools/*") {
>> +                             next if /defaults$/;
>> +                             print "\t" . basename($_) . "\n";
>> +                     }
>> +                     exit(1);
>> +             }
>
> I know the call to usage() against "-h" has the same issue, but I think
> people find it offensive when they ask for help and the command reports a
> failure with a non-zero exit code.
>
> Other than that, looks good from a cursory look.  Davidd, any comments?

I agree that the rework to make -h return 0 is sensible. I also think the `cando()` suggestion later in this thread is the way to go.

Thanks guys,
-- 
David
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 7 in “difftool: print list of valid tools with '--tool-help'”
  1. difftool: print list of valid tools with '--tool-help'Tim Henigan, Mar 15, 2012
  2. Junio C HamanoMar 15, 2012
  3. David AguilarMar 17, 2012
  4. Junio C HamanoMar 15, 2012
  5. Tim HeniganMar 23, 2012
  6. Junio C HamanoMar 23, 2012
  7. 9/9 difftool: print list of valid tools with '--tool-help'Tim Henigan, Mar 26, 2012

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.