shell-completions
shell-completions copied to clipboard
Collection of shell (bash, zsh) tab completion scripts for various command line tools
Collection of shell tab completion scripts for various command line tools
These scripts are automatically generated from YAML files which can be found
under specs/.
The format supports nested subcommands, specifying enums for possible parameters/option values and dynamic completion calling an external command.
The generation is done with the appspec tool (see "Developing" below).
Currently it supports bash and zsh completions.
List of commands
cpan-upload- upload a distribution to the CPANcpan- easily interact with CPAN from the command linecpanm- Install CPAN modulesdancer2- Dancer2 command line interfacedzil- do stuff with your distfallocate- Preallocate or deallocate space to a filefatpack- Pack perl script and modules into standalone scriptfile- determine file typefzf- a command-line fuzzy finderh2xs- convert .h C header files to Perl extensionshtpasswd- Manage user files for basic authenticationhypnotoad- Hypnotoad HTTP and WebSocket serverjq- Command-line JSON processorjson_pp- JSON::PP command utilityjson_xs- JSON::XS commandline utilitylocate- Find files by namelwp-request- Simple command line user agent (Aliases GET, HEAD, POST)mojo- The Mojolicious command systemmorbo- Morbo HTTP and WebSocket development servermpath- display the full path to a perl module (installed locally)pip- A tool for installing and managing Python packagesplackup- Run PSGI application with Plack handlerspod2html- convert .pod files to .html filesprove- Run tests through a TAP harnessstarman- High-performance preforking PSGI/Plack web servertower-cli- Ansible Tower Commandlineyamllint- A linter for YAML filesysh- The YAML Test Shellzild- Dist::Zilla Mixed Up
Installation
git clone https://github.com/perlpunk/shell-completions
Usage
Look into the specs/commandname.yaml for specific usage instructions.
Bash
For a specific script, just source it:
$ source /path/to/shell-completions/bash/commandname.bash
Put this in your .bashrc for using all completions:
for i in /path/to/shell-completions/bash/*.bash; do source $i; done
Using only one <TAB> keypress like in zsh
You can enable this by putting the following in your ~/.inputrc:
set show-all-if-ambiguous on
See GNU Readline Init File Syntax.
Zsh
For activating the completions, you can do:
% fpath=(/path/to/shell-completions/zsh $fpath)
% compinit
To just try out completion for one specific script, you can also do:
% source /path/to/shell-completions/zsh/_commandname
% compdef _commandname commandname
Put this in your .zshrc for activating all completions:
# before the compinit call
fpath=('/path/to/shell-completions/zsh' $fpath)
This way zsh won't load all functions at startup, but the completions will get autoloaded dynamically when the command is first used.
When developing a new completion, after a change it's enough to source it,
without calling compinit again:
% source /path/to/shell-completions/zsh/_commandname
Developing
The appspec tool is used to generate the completions. You don't need it
if you just want to use the completions.
If you want to modify or add a new completion, install the App::AppSpec
perl module, or use the standalone script:
% git clone https://github.com/perlpunk/App-AppSpec-p5 -b standalone appspec
% PATH=$PWD/appspec/bin:$PATH
For more details see https://github.com/perlpunk/App-AppSpec-p5.
Create a new specification specs/commandname.yaml and type:
make commandname
See Also
- https://github.com/zsh-users/zsh-completions - Over 130 completion scripts for zsh
- https://github.com/unixorn/awesome-zsh-plugins - A collection of ZSH frameworks, plugins & themes
- https://github.com/complete-shell - A different approach for generating and installing completions for bash