question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FEATURE] Prevent install-completion from failing when command is not available

See original GitHub issue

When 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:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dbantycommented, May 1, 2020

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.

1reaction
tiangolocommented, Apr 13, 2020

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. 🚀

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found