Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Zsh Autosuggestions | 26,292 | 3 days ago | 1 | March 03, 2021 | 144 | mit | Shell | |||
Fish-like autosuggestions for zsh | ||||||||||
Kubectx | 14,910 | 2 months ago | 26 | January 11, 2022 | 46 | apache-2.0 | Go | |||
Faster way to switch between clusters and namespaces in kubectl | ||||||||||
Zsh Completions | 6,018 | 6 days ago | 1 | March 03, 2021 | 36 | other | Shell | |||
Additional completion definitions for Zsh. | ||||||||||
Fasd | 5,027 | 3 years ago | 1 | February 27, 2018 | 109 | mit | Shell | |||
Command-line productivity booster, offers quick access to files and directories, inspired by autojump, z and v. | ||||||||||
Zsh Autocomplete | 3,331 | 2 days ago | 6 | mit | Shell | |||||
🤖 Real-time type-ahead completion for Zsh. Asynchronous find-as-you-type autocompletion. | ||||||||||
Git Flow Completion | 2,588 | 5 years ago | 16 | mit | Shell | |||||
Bash, Zsh and fish completion support for git-flow. | ||||||||||
Dotfiles | 2,154 | 4 years ago | 7 | mit | VimL | |||||
config files for zsh, bash, completions, gem, git, irb, rails | ||||||||||
Fzf Tab | 2,055 | 2 months ago | 57 | mit | Shell | |||||
Replace zsh's default completion selection menu with fzf! | ||||||||||
Gibo | 1,814 | 9 months ago | 1 | February 27, 2018 | 1 | unlicense | Shell | |||
Easy access to gitignore boilerplates | ||||||||||
Omelette | 1,260 | 155 | 101 | a year ago | 21 | September 21, 2021 | 15 | mit | CoffeeScript | |
Omelette is a simple, template based autocompletion tool for Node and Deno projects with super easy API. (For Bash, Zsh and Fish) |
Enhanced completion for Click
Add automatic completion support for fish, Zsh, Bash and PowerShell to Click.
All the supported shells are able to complete all the command line arguments and options defined with click. In addition, fish and Zsh are also displaying the options and commands help during the completion.
In order to activate the completion, you need to:
click_completion
module;click_completion
initializationclick_completion
monkey-patches click
in order to enhance the native
completion capabilities. This is done very simply:
import click_completion
click_completion.init()
Once done, your click application is ready for completion.
click_completion
has some functions to produce the code to be executed
by the shell during the completion, and to permanently install this code
in a place that is automatically loaded by the shell.
The key functions are:
get_code
install
An example of usage can be found in examples/click-completion-command and in examples/click-completion-callback
click-completion
obviously depends on click
. Jinja2
is used to
generate the shell specific code.
And of course to make it useful, you'll need to use fish, Bash, Zsh or PowerShell.
click_complete
has a startswith
function that can be replaced by a
custom one in order to customize the completion. Some extra environment
variable to be used during the completion can be passed to get_code
and install
. An example is available in examples/click-completion-command.
The custom parameter type may reimplement the complete
method in order
to customize the completion result. The complete
method takes the
current context and the incomplete argument to be completed. It can
return either a list of argument value that match the incomplete
argument, or a list of tuples (arg, help)
. This last form is preferred
because it allows to display the help during the completion for the
shells that supports it.
An example can be found in the class DocumentedChoice
in click_completion/init.py.
As click, the general way click_completion
works is through a magic environment
variable called _<PROG_NAME>_COMPLETE
, where <PROG_NAME>
is your application
executable name in uppercase with dashes replaced by underscores.
If your tool is called foo-bar, then the magic variable is called
_FOO_BAR_COMPLETE
. By exporting it with the source
value it will spit out the
activation script which can be trivially activated.
For instance, to enable fish completion for your foo-bar script, this is what
you would need to put into your ~/.config/fish/completions/foo-bar.fish
eval (env _FOO_BAR_COMPLETE=source-fish foo-bar)
From this point onwards, your script will have fish completion enabled.
The above activation example will always invoke your application on startup. This might be slowing down the shell activation time significantly if you have many applications. Alternatively, you could also ship a file with the contents of that, which is what Git and other systems are doing.
This can be easily accomplished:
_FOO_BAR_COMPLETE=source-fish foo-bar > ~/.config/fish/completions/foo-bar.fish
Licensed under the MIT, see LICENSE.
Contributions are all very welcome!
This may be in the form of bug reports, pull requests, …
A few subjects need some attention currently: