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

[feature] support customization of zsh's compdef? #87

Open
Freed-Wu opened this issue Aug 27, 2022 · 0 comments
Open

[feature] support customization of zsh's compdef? #87

Freed-Wu opened this issue Aug 27, 2022 · 0 comments
Labels
enhancement New feature or request shell-zsh

Comments

@Freed-Wu
Copy link
Contributor

First line of zsh completion script must be compdef program_name. zsh support compdef -P a_glob_expr, such as compdef pip-cache -P pip[0-9.]# will let this completion script support pip-cache, pip, pip3, pip3.9, etc.

A new feature

    shtab.add_argument_to(parser, compdef="XXXX")

Result:

#compdef XXX
Freed-Wu added a commit to Freed-Wu/ptpython that referenced this issue Aug 28, 2022
ptpython --print-completion bash | sudo tee /usr/share/bash-completion/completions/ptpython
ptpython --print-completion zsh | sed 's/compdef ptpython/compdef -P pt(i|)python[0-9.]#/' | sudo tee /usr/share/zsh/site-functions/_ptpython  # wait <iterative/shtab#87>
ptpython --print-completion tcsh | sudo tee /etc/profile.d/ptpython.completion.csh
Freed-Wu added a commit to Freed-Wu/ptpython that referenced this issue Aug 28, 2022
ptpython --print-completion bash | sudo tee /usr/share/bash-completion/completions/ptpython
ptpython --print-completion zsh | sed 's/compdef ptpython/compdef -P pt(i|)python[0-9.]#/' | sudo tee /usr/share/zsh/site-functions/_ptpython  # wait <iterative/shtab#87>
ptpython --print-completion tcsh | sudo tee /etc/profile.d/ptpython.completion.csh
Freed-Wu added a commit to Freed-Wu/ptpython that referenced this issue Aug 28, 2022
ptpython --print-completion bash | sudo tee /usr/share/bash-completion/completions/ptpython
ptpython --print-completion zsh | sed 's/compdef ptpython/compdef -P pt(i|)python[0-9.]#/' | sudo tee /usr/share/zsh/site-functions/_ptpython  # wait <iterative/shtab#87>
ptpython --print-completion tcsh | sudo tee /etc/profile.d/ptpython.completion.csh
Freed-Wu added a commit to Freed-Wu/ptpython that referenced this issue Sep 3, 2022
ptpython --print-completion bash | sudo tee /usr/share/bash-completion/completions/ptpython
ptpython --print-completion zsh | sed 's/compdef ptpython/compdef -P pt(i|)python[0-9.]#/' | sudo tee /usr/share/zsh/site-functions/_ptpython  # wait <iterative/shtab#87>
ptpython --print-completion tcsh | sudo tee /etc/profile.d/ptpython.completion.csh
Freed-Wu added a commit to Freed-Wu/ptpython that referenced this issue Sep 4, 2022
ptpython --print-completion bash | sudo tee /usr/share/bash-completion/completions/ptpython
ptpython --print-completion zsh | sed 's/compdef ptpython/compdef -P pt(i|)python[0-9.]#/' | sudo tee /usr/share/zsh/site-functions/_ptpython  # wait <iterative/shtab#87>
ptpython --print-completion tcsh | sudo tee /etc/profile.d/ptpython.completion.csh
Freed-Wu added a commit to Freed-Wu/ptpython that referenced this issue Sep 12, 2022
ptpython --print-completion bash | sudo tee /usr/share/bash-completion/completions/ptpython
ptpython --print-completion zsh | sed 's/compdef ptpython/compdef -P pt(i|)python[0-9.]#/' | sudo tee /usr/share/zsh/site-functions/_ptpython  # wait <iterative/shtab#87>
ptpython --print-completion tcsh | sudo tee /etc/profile.d/ptpython.completion.csh
Freed-Wu added a commit to Freed-Wu/ptpython that referenced this issue Sep 12, 2022
ptpython --print-completion bash | sudo tee /usr/share/bash-completion/completions/ptpython
ptpython --print-completion zsh | sed 's/compdef ptpython/compdef -P pt(i|)python[0-9.]#/' | sudo tee /usr/share/zsh/site-functions/_ptpython  # wait <iterative/shtab#87>
ptpython --print-completion tcsh | sudo tee /etc/profile.d/ptpython.completion.csh
Freed-Wu added a commit to Freed-Wu/ptpython that referenced this issue Sep 12, 2022
ptpython --print-completion bash | sudo tee /usr/share/bash-completion/completions/ptpython
ptpython --print-completion zsh | sed 's/compdef ptpython/compdef -P pt(i|)python[0-9.]#/' | sudo tee /usr/share/zsh/site-functions/_ptpython  # wait <iterative/shtab#87>
ptpython --print-completion tcsh | sudo tee /etc/profile.d/ptpython.completion.csh
Freed-Wu added a commit to Freed-Wu/ptpython that referenced this issue Sep 14, 2022
ptpython --print-completion bash | sudo tee /usr/share/bash-completion/completions/ptpython
ptpython --print-completion zsh | sed 's/compdef ptpython/compdef -P pt(i|)python[0-9.]#/' | sudo tee /usr/share/zsh/site-functions/_ptpython  # wait <iterative/shtab#87>
ptpython --print-completion tcsh | sudo tee /etc/profile.d/ptpython.completion.csh
Freed-Wu added a commit to Freed-Wu/ptpython that referenced this issue Sep 14, 2022
ptpython --print-completion bash | sudo tee /usr/share/bash-completion/completions/ptpython
ptpython --print-completion zsh | sed 's/compdef ptpython/compdef -P pt(i|)python[0-9.]#/' | sudo tee /usr/share/zsh/site-functions/_ptpython  # wait <iterative/shtab#87>
ptpython --print-completion tcsh | sudo tee /etc/profile.d/ptpython.completion.csh
@casperdcl casperdcl added enhancement New feature or request shell-zsh labels Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request shell-zsh
Projects
None yet
Development

No branches or pull requests

2 participants