Code Monkey home page Code Monkey logo

Comments (8)

shelper avatar shelper commented on May 21, 2024 5

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.

wpm avatar wpm commented on May 21, 2024 5

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.

DarkaMaul avatar DarkaMaul commented on May 21, 2024

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.

tiangolo avatar tiangolo commented on May 21, 2024

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.

github-actions avatar github-actions commented on May 21, 2024

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.

ShivKJ avatar ShivKJ commented on May 21, 2024

I am still facing the same issue. Let me know if this has been resolved

from typer.

shelper avatar shelper commented on May 21, 2024

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.

paw-lu avatar paw-lu commented on May 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.