vrk completions
vrk completions generates tab-completion scripts for bash, zsh, and fish.
The problem
A multicall binary has 26 tool names and hundreds of flags. Without tab completion you are guessing names and checking --help constantly.
The solution
vrk completions generates tab-completion scripts for bash, zsh, and fish. After installing, vrk <tab> completes tool names and vrk tok --<tab> completes flags. The completions are generated from the binary itself, so they always match the installed version.
Before and after
Before
# write a bash completion script by hand
_vrk_complete() {
COMPREPLY=($(compgen -W "tok jwt epoch ..." -- "${COMP_WORDS[1]}"))
}
complete -F _vrk_complete vrk
After
vrk completions bash > ~/.bash_completion.d/vrk
Example
vrk completions bash > ~/.bash_completion.d/vrk
Exit codes
| Code | Meaning |
|---|---|
| 0 | Script emitted to stdout |
| 1 | Unknown shell argument |
| 2 | No shell argument provided |
Flags
| Flag | Short | Type | Description |
|---|---|---|---|
--json | -j | bool | Emit errors as JSON |
Setup
Bash
vrk completions bash > ~/.bash_completion.d/vrk
source ~/.bash_completion.d/vrk
Zsh
vrk completions zsh > ~/.zsh/completions/_vrk
# Add to ~/.zshrc if not already there:
# fpath=(~/.zsh/completions $fpath)
# autoload -Uz compinit && compinit
Fish
vrk completions fish > ~/.config/fish/completions/vrk.fish
What you get
After installing completions:
$ vrk <tab>
assert base chunk coax completions digest emit epoch grab ...
$ vrk tok --<tab>
--check --json --model --quiet
Tool names and flags are completed from the binary itself, so they always match the installed version.
When it fails
Unknown shell:
$ vrk completions powershell
error: completions: unsupported shell "powershell"
$ echo $?
1
No shell specified:
$ vrk completions
usage error: completions: shell argument required (bash, zsh, fish)
$ echo $?
2