utils

Child Commands

Command
Description
completion
Generate completion script

completion

Grey Matter CLI is powered by Cobra which can generate shell completions for multiple shells. The currently supported shells are:
  • Bash
  • Zsh
The detailed instruction is located here.
Usage:
1
greymatter utils completion [bash|zsh|fish|powershell]
Copied!
To see how to use the script that was generated by above command, see the help by running:
1
greymatter utils completion -h
Copied!

Bash

1
source <(greymatter utils completion bash)
Copied!
To load completions for each session, execute once:

Linux

1
greymatter utils completion bash > /etc/bash_completion.d/greymatter
Copied!

MacOS

1
greymatter utils completion bash > /usr/local/etc/bash_completion.d/greymatter
Copied!
Note for bash completion, you may need to install a newer version of bash-completion. If you're using the Homebrew version of bash, simply
1
brew install bash-completion
Copied!
and add
1
if [ -f $(brew --prefix)/etc/bash_completion ]; then
2
. $(brew --prefix)/etc/bash_completion
3
fi
Copied!
to your ~/.bashrc.

Zsh

If shell completion is not already enabled in your environment you will need to enable it. You can execute the following once:
1
echo "autoload -U compinit; compinit" >> ~/.zshrc
Copied!
To load completions for each session, execute once:
1
greymatter utils completion zsh > "${fpath[1]}/_greymatter"
Copied!
You will need to start a new shell for this setup to take effect.

Fish

1
greymatter utils completion fish | source
Copied!
To load completions for each session, execute once:
1
greymatter utils completion fish > ~/.config/fish/completions/greymatter.fish
Copied!
Note that you do need at least Fish 3.1.0 for this to work.

PowerShell

Please refer to PowerShell Completions for details.
Last modified 10mo ago
Export as PDF
Copy link