Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop use default command on complition #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

y-marui
Copy link

@y-marui y-marui commented Apr 18, 2022

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.

@pneff
Copy link

pneff commented Sep 13, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants