nself completion
nself completion — ɳSelf documentation.
Generate shell completion scripts.
Synopsis
nself completion [bash|zsh|fish]
Description
nself completion generates shell completion scripts for Bash, Zsh, and Fish. Once installed, pressing Tab will autocomplete nself commands, subcommands, and flags in your shell.
Completion scripts are generated by Cobra and support all commands and flags defined in the CLI.
Subcommands
| Subcommand | Description |
|---|---|
bash | Generate Bash completion script |
zsh | Generate Zsh completion script |
fish | Generate Fish completion script |
Installation
Bash
# Add to current session
eval "$(nself completion bash)"
# Persist across sessions (Linux)
nself completion bash > /etc/bash_completion.d/nself
# Persist across sessions (macOS with Homebrew bash)
nself completion bash > $(brew --prefix)/etc/bash_completion.d/nself
Zsh
# Add to current session
eval "$(nself completion zsh)"
# Persist across sessions, add to ~/.zshrc
echo 'eval "$(nself completion zsh)"' >> ~/.zshrc
# Or write to a completions directory
nself completion zsh > "${fpath[1]}/_nself"
Fish
# Add to current session
nself completion fish | source
# Persist across sessions
nself completion fish > ~/.config/fish/completions/nself.fish
Examples
# Generate Bash completion
nself completion bash
# Generate Zsh completion
nself completion zsh
# Generate Fish completion
nself completion fish
# Instant setup for Bash
eval "$(nself completion bash)"
# Instant setup for Zsh
eval "$(nself completion zsh)"