cod should check for existing completions for aliased commands
Opened this issue · 0 comments
zachriggle commented
I have a bunch of wrapper scripts around ripgrep rg
, and I alias all of their completions to rg
since the arguments get passed-through.
Autocompletion already works in this manner, so cod
should not try to learn them.
$ cat bin/example-script
#!/usr/bin/env zsh
rg "$@"
$ example-script <tab>
-- option --
--after-context -A -- specify lines to show after each match
--and -- Logical AND
--auto-hybrid-regex -- dynamically use PCRE2 if necessary
--before-context -B -- specify lines to show before each match
--binary -- search binary files, don't print binary data
--block-buffered -- force block buffering
--byte-offset -b -- show 0-based byte offset for each matching line
--case-sensitive -s -- search case-sensitively
However, cod
tries to learn it when passing --help
.
$ example-script --help
...
OPTIONS:
-A, --after-context <NUM>
...
┌──> /Users/zachriggle/..../bin/example-script --help
└─── cod: learn this command? [yn?] >
Here's how they are registered, tldr is compdef mycommand=rg
.
#!/usr/bin/env zsh
BINDIR="${0:h}/bin"
path=("$BINDIR" $path)
for script in "$BINDIR"/*(*); do
name="$script:t"
compdef "$name"=rg
done
There is no fpath
entry for these, they are just compdef
aliases. This should be consulted before offering to learn a command.