Skip to content

completion writes a script for Bash, Zsh, Fish, or PowerShell to standard output; diagnostics go to standard error. Choose the shell you actually use, then save or load the result according to that shell's completion setup.

Usage

rootform completion <shell> [options]
SHELL

Options

Global options

FlagTypeDefaultDescription
-h, --helpboolfalseshow how to use rootform completion
--colormodeautocolor human output: auto|always|never; default: auto
--no-pagerboolfalseprint a long report in full instead of opening it in less
rootform completion bash > rootform.bash
rootform completion zsh > _rootform
rootform completion fish > rootform.fish
rootform completion powershell > rootform.ps1
Shell

These examples write files in the current directory. To activate completion in the current shell and load it in future shells, use the commands for your shell below.

Bash

Cobra's generated Bash script uses helpers from bash-completion. Load that package before loading the generated Rootform script.

source ./rootform.bash
Shell

Zsh

Initialize Zsh completions before loading Rootform's script:

autoload -Uz compinit
compinit
source ./_rootform
Shell

Fish

fish
source ./rootform.fish

PowerShell

. ./rootform.ps1
PowerShell

For future shells, move the generated file to a stable completion directory and source its absolute path from ~/.bashrc, ~/.zshrc, ~/.config/fish/config.fish, or your PowerShell profile. Initialize bash-completion or compinit before loading Rootform where required.

Status 0 means the completion script was generated, 2 means the command was used incorrectly, and 4 means the completion script could not be written. Use rootform version to identify the executable providing the completion script.