click-default-group icon indicating copy to clipboard operation
click-default-group copied to clipboard

Stop use default command on complition

Open y-marui opened this issue 3 years ago • 1 comments

If _{prog_name}_COMPLETE is set, the click will execute completion instead of normal flow. On completion, adding the default command name to arg cause trouble.

y-marui avatar Apr 18 '22 01:04 y-marui

Hi @sublee

I just came across this one in my attempt to implement auto-completion for simonw/llm (in simonw/llm#261). The proposed fix does work in that case as well.

Can I add anything to this pull request to get it merged? E.g. test coverage?

In the case of the LLM tool I observed the following. Without the fix, no completion is output:

$ env COMP_WORDS="llm" COMP_CWORD=1 _LLM_COMPLETE=bash_complete llm
(no_output)

Once I apply the fix, it works:

$ env COMP_WORDS="llm" COMP_CWORD=1 _LLM_COMPLETE=bash_complete llm
plain,aliases
plain,chat
plain,collections
plain,embed
plain,embed-models
plain,embed-multi
plain,install
plain,keys
plain,logs
plain,models
plain,openai
plain,plugins
plain,prompt
plain,similar
plain,templates
plain,uninstall

pneff avatar Sep 13 '23 04:09 pneff