[FEATURE] Prevent install-completion from failing when command is not available
See original GitHub issueWhen using click-completion in previous versions, if the command was not available in my path when the shell started, it wouldn’t cause an error. I have a variety of command line utilities added to various web apps that I don’t want installed globally where I’d have to update them all the time. Instead, they are available when I’m in the poetry shell for that project.
I don’t completely understand what click-completion was doing before, but it looks like it was only trying to evaluate completion when calling the command instead of at startup:
#compdef openapi-python-client
_openapi-python-client() {
eval $(env COMMANDLINE="${words[1,$CURRENT]}" _OPENAPI_PYTHON_CLIENT_COMPLETE=complete-zsh openapi-python-client)
}
if [[ "$(basename -- ${(%):-%x})" != "_openapi-python-client" ]]; then
compdef _openapi-python-client openapi-python-client
fi
Whereas Typer attempts to evaluate the command immediately:
eval "$(_OPENAPI_PYTHON_CLIENT_COMPLETE=source_zsh openapi-python-client)"
Would it be possible to add some similar delayed evaluation to Typer?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to solve vs code - gopls command is not available
If you are using go1.14, either click the button (or run "Go: Install/Update Tools" command from the command palette) or, install tools in ......
Read more >How to disable the command prompt's auto-close upon ...
The trick here is that the command being executed is indeed a batch file, includes a pause statement at the end, but the...
Read more >How to troubleshoot Windows Installer errors - Microsoft Support
Click Start windows icon · At the command prompt, type MSIExec, and then press Enter. · If the MSI engine is working, you...
Read more >django-admin and manage.py
The django-admin script should be on your system path if you installed ... Run django-admin help --commands to display a list of all...
Read more >Changes — Click Documentation (8.1.x)
autocompletion parameter to Command is renamed to shell_complete . ... If a default value is invalid, it does not prevent showing help text....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hey it works! Thanks! I did have to move the generated lines up in my .zshrc for them to start working. I put it above where I’m sourcing oh-my-zsh.sh because I’ve seen that be a problem elsewhere.
Yep, it makes sense and I agree. In fact, I’m suffering with the same problem as you 😂
So yeah, I’m not sure what will be the best approach, but I will definitely update it to work for that use case. 🚀