cmd completion - nself-org/cli GitHub Wiki
Generate shell completion scripts.
nself completion [bash|zsh|fish|powershell]
nself completion generates shell completion scripts for Bash, Zsh, Fish, and PowerShell. Once installed, pressing Tab completes nself commands, subcommands, and flags in your shell.
Completion scripts are generated by Cobra and cover all commands and flags defined in the CLI. Run nself completion <shell> to print the script, then follow the installation steps for your shell below.
| Subcommand | Description |
|---|---|
bash |
Generate Bash completion script |
zsh |
Generate Zsh completion script |
fish |
Generate Fish completion script |
powershell |
Generate PowerShell completion script |
# Add to current session only
eval "$(nself completion bash)"
# Persist across sessions (append to file)
nself completion bash >> ~/.bash_completion
source ~/.bash_completion
# System-wide on Linux
nself completion bash > /etc/bash_completion.d/nself
# System-wide on macOS with Homebrew bash
nself completion bash > "$(brew --prefix)/etc/bash_completion.d/nself"# Add to current session only
eval "$(nself completion zsh)"
# Persist across sessions via ~/.zshrc
echo 'eval "$(nself completion zsh)"' >> ~/.zshrc
# Or write to a fpath directory and use autoload
nself completion zsh > ~/.zsh/_nself
# Add these lines to ~/.zshrc if not already present:
# fpath=(~/.zsh $fpath)
# autoload -Uz compinit
# compinit# Add to current session only
nself completion fish | source
# Persist across sessions
nself completion fish > ~/.config/fish/completions/nself.fish# Add to current session only
nself completion powershell | Out-String | Invoke-Expression
# Persist for the current user across sessions
nself completion powershell > $PROFILE.CurrentUserAllHosts
# Or append to the existing profile
nself completion powershell | Out-String | Add-Content $PROFILE.CurrentUserAllHosts# Generate and print the Bash completion script
nself completion bash# Install Bash completions for the current session
eval "$(nself completion bash)"# Install Zsh completions for the current session
eval "$(nself completion zsh)"# Install Fish completions persistently
nself completion fish > ~/.config/fish/completions/nself.fish# Install PowerShell completions for the current user
nself completion powershell > $PROFILE.CurrentUserAllHosts- Commands, full command index
- cmd-version, display the current CLI version