Comments (8)
well , i think i solved this problem by adding the following lines to my .zshrc
hope this helps
autoload -Uz compinit
zstyle ':completion:*' menu select
fpath+=~/.zfunc
compinit
from typer.
From here I got the workaround to add compinit -D
to the end of my .zshrc
file. I have no idea what it means, but it worked.
from typer.
Actually, there is a bug with the generation because the full path of the app file (foo in your case) is not written.
Temp workaround:
Replace the generated line (in ~/.zshrc
) by the following one:
eval $(env COMMANDLINE="${words[1,$CURRENT]}" _APP.PY_COMPLETE=complete-zsh python PATH_TO_FOO/foo.py)
You could also report the bug to Click-Completion
from typer.
Hi everyone! Thanks for the discussion here.
For auto completion to work, you have to create a Python package, there's a new section in the docs about that: https://typer.tiangolo.com/tutorial/package/ 📝
If you just want to run simple scripts and have completion in your shell, you can use the new Typer CLI: https://typer.tiangolo.com/typer-cli/ 🚀 ⌨️
from typer.
Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues.
from typer.
I am still facing the same issue. Let me know if this has been resolved
from typer.
same here, i have a tool called zetta, that i made it a command line tool with [tool.poetry.scripts]
I run poetry install
, and then which zetta
, shows me where the zetta executable is
then i run zetta --install-completion zsh
, and got message confirmed and in my ~/.zfunc/_zetta
i have
_zetta_completion() {
eval $(env COMMANDLINE="${words[1,$CURRENT]}" _APP.PY_COMPLETE=complete-zsh zetta)
}
but the autocompletion still does not work....
same steps for bash works...
from typer.
I'm still not able to get completion to work.
My setup is pretty much identical to @shelper
My (entire) ~./zshrc
:
# ~/.zshrc
autoload -Uz compinit
fpath+=~/.zfunc
compinit
My ~/.zfunc/_nbpreview
:
#compdef nbpreview
_nbpreview_completion() {
eval $(env _TYPER_COMPLETE_ARGS="${words[1,$CURRENT]}" _NBPREVIEW_COMPLETE=complete_zsh nbpreview)
}
compdef _nbpreview_completion nbpreview
Seems the correct file is registered,
but when it comes to actual completion,
nothing happens.
# Command to show which completion file is registered
% whence -v $_comps[nbpreview]
_nbpreview_completion is a shell function from /Users/pawlu/.zfunc/_nbpreview
% nbpreview --<TAB>
# No output, completion
from typer.
Related Issues (20)
- How do I pass the None value explicitly? HOT 2
- Documentation is misleading. new `typer.run` behavior HOT 2
- See if rich 13.x is compatible HOT 4
- Using `some_type | None` syntax for type annotations causes error in python 3.11 HOT 12
- unlimited argument for an option with comma spliter HOT 1
- TAB completion is giving local directory files where command is called. HOT 2
- Support for bytes in Options and Arguments HOT 2
- Is it possible to include a Prolog in `--help` HOT 2
- Get the typer output with html format to provide it to termynal HOT 4
- how to use typer on class method __init__ with self argument, got this error: Error: Missing argument 'SELF'. HOT 2
- Support for localization of messages HOT 1
- Auto-completion when application works in 2 modes (GUI, CLI) HOT 1
- DOC: Documentation of passing multiple values in "option" vs "argument" isn't sufficiently explicit HOT 1
- SIGINT from docker is ignored HOT 4
- 🚀 Roadmap HOT 2
- Source distribution of 0.11.0 is missing the `docs_src` folder HOT 1
- 🐛 Upgrading from `typer<0.12.0` to `typer==0.12.0` breaks the install by partially removing the package/module files HOT 4
- Rich markup in generated Markdown docs
- Add CI configs to run tests on Windows and MacOS
- Rich markup in Zsh completion help lines
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typer.