git-annex/doc/todo/allow_git-annex_addon_commands.mdwn
Joey Hess aec2cf0abe
addon commands
Seems only fair, that, like git runs git-annex, git-annex runs
git-annex-foo.

Implementation relies on O.forwardOptions, so that any options are passed
through to the addon program. Note that this includes options before the
subcommand, eg: git-annex -cx=y foo

Unfortunately, git-annex eats the --help/-h options.
This is because it uses O.hsubparser, which injects that option into each
subcommand. Seems like this should be possible to avoid somehow, to let
commands display their own --help, instead of the dummy one git-annex
displays.

The two step searching mirrors how git works, it makes finding
git-annex-foo fast when "git annex foo" is run, but will also support fuzzy
matching, once findAllAddonCommands gets implemented.

This commit was sponsored by Dr. Land Raider on Patreon.
2021-02-02 16:32:49 -04:00

14 lines
531 B
Markdown

Like git annex runs git-annex, git-annex foo could run git-annex-foo when
it's not built-in.
One user of this would be annex-review-unused, which
its author would rather name git-annex-reviewunused if that
made "git annex reviewunused" work.
In CmdLine, where autocorrect is handled, it would need to
search the path for all "git-annex-" commands and then
either dispatch the one matching the inputcmdname,
or do autocorrect with the list of those commands
included along with the builtins. --[[Joey]]
> [[done]] --[[Joey]]