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

Re: Custom subcommand help handlers

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Dec 22, 2021, 17:44 UTC
Message-ID
<211222.865yrgplu9.gmgdl@evledraar.gmail.com>
In-Reply-To
<nycvar.QRO.7.76.6.2112221640340.347@tvgsbejvaqbjf.bet>
On Wed, Dec 22 2021, Johannes Schindelin wrote:
Show 36 quoted lines
> Hi Ævar,
>
> On Tue, 21 Dec 2021, Ævar Arnfjörð Bjarmason wrote:
>
>> On Mon, Dec 20 2021, Johannes Schindelin wrote:
>>
>> > On Sat, 18 Dec 2021, Sean Allred wrote:
>> >
>> >> I've got a custom subcommand I'm distributing in my company to integrate
>> >> with our bug-tracker. It's a pretty robust utility and has its own help
>> >> function, but running `git foo --help` doesn't pass --help to my git-foo
>> >> utility. [...]
>> >>
>> >> What's the best way to go about this?
>> >
>> > I think you might need to be a bit more careful than just looking whether
>> > the command in question is a built-in or not. It could be delivered as a
>> > script or executable inside `libexec/git-core`. So maybe check that,
>> > something like this:
>> >
>> > -- snip --
>> > [...]
>> > -- snap --
>> >
>> > Of course, this might break existing users' setups where they ship a Git
>> > command together with a manual page.
>> >
>> > A potential remedy against that would be, as you say, a config option.
>> > Maybe defaulting to the manual page if `help.format` is `man`, otherwise
>> > defaulting to passing `--help` to the command.
>>
>> What are the cases that require us to inexpect our --exec-path at
>> runtime, as opposed to having a list of commands we know we put there at
>> "install" time?
>
> It is a simple solution. Why even suggest a complex alternative, I wonder.
You're suggesting the more complex alternative.

We already have a way in that same file to dump both built-ins and other known commands:

	git --list-cmds=builtins
	git --list-cmds=main

And isn't your is_in_git_exec_path() basically a re-implementation of what we already get from:

	git --list-cmds=others
?

Hence my question. I.e. if you don't have git-send-email installed why would you take your is_in_git_exec_path()? I.e. start treating it as "others" would be treated. We know it's ours, it's just not installed at the moment.

But those aren't the same thing, so either you didn't know that we have this data already, or the difference is important for some reason you haven't explained.

Previous: Johannes SchindelinNext: Sean Allred
Message 19 of 20 in “Custom subcommand help handlers”
  1. Sean AllredDec 18, 2021
  2. Ævar Arnfjörð BjarmasonDec 20, 2021
  3. Erik Cervin EdinDec 20, 2021
  4. brian m. carlsonDec 20, 2021
  5. Junio C HamanoDec 20, 2021
  6. Erik Cervin EdinDec 21, 2021
  7. Johannes SchindelinDec 22, 2021
  8. Junio C HamanoDec 22, 2021
  9. Erik Cervin EdinDec 22, 2021
  10. Junio C HamanoDec 23, 2021
  11. Erik Cervin EdinDec 23, 2021
  12. Philip OakleyDec 23, 2021
  13. Junio C HamanoDec 24, 2021
  14. Philip OakleyDec 24, 2021
  15. Sean AllredFeb 12, 2022
  16. Johannes SchindelinDec 20, 2021
  17. Ævar Arnfjörð BjarmasonDec 21, 2021
  18. Johannes SchindelinDec 22, 2021
  19. Ævar Arnfjörð BjarmasonDec 22, 2021
  20. Sean AllredFeb 12, 2022

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.