Tab-complete every spell
$ grim completion zsh
grim has many commands, and most of the long ones come in families: server:dev:add-project, infra:aws-cloudtrail. Nobody types those from memory twice. Set completion up once per machine, right after the install, and Tab does it.
Usage
$ grim completion zsh > ~/.grim/completion.zsh # write the script once
$ echo 'source ~/.grim/completion.zsh' >> ~/.zshrc # load it in every shell
$ grim completion fish | source # fish, current session onlyIt runs from anywhere. With no argument the shell is taken from $SHELL. bash, zsh and fish are supported; bash additionally needs the bash-completion package.
Arguments and options
Dump the shell completion script
Usage
grim completion [--debug] [--] [<shell>]Arguments
| Argument | Description |
|---|---|
shell |
The shell type (e.g. "bash"), the value of the "$SHELL" env var will be used if this is not given (optional) |
Options
| Option | Description |
|---|---|
--debug |
Tail the completion debug log |
What it actually does
- Prints a script to standard output. Nothing is installed and no file is touched. Where the script goes is up to you, which is why the examples redirect it.
- The script calls grim back. On every Tab your shell asks
grimfor the candidates, so the suggestions always match the version you have installed: new commands appear aftergrim self-updatewith no second setup.
Pitfalls
Nothing happens on Tab
The script was written but the running shell has not loaded it. Open a new terminal, or source the file by hand. After that, grim completion --debug follows the log of what the shell asked and what grim answered.
After it finishes
Open a new shell and try grim ser and Tab. Command names and option names complete.
Related spells
grim list
See every command
List every command grim has, or only the ones in one namespace.
grim help
Read a command's usage
Print the description, usage, arguments and options of one command, in the terminal.
grim self-update
Update grim itself
Replace the grim phar with the newest release. Projects are not touched.