Skip to content

Add shell completions#1856

Open
avdv wants to merge 1 commit into
namespacelabs:mainfrom
avdv:generate-shell-completion
Open

Add shell completions#1856
avdv wants to merge 1 commit into
namespacelabs:mainfrom
avdv:generate-shell-completion

Conversation

@avdv

@avdv avdv commented Jul 3, 2026

Copy link
Copy Markdown

While I'm still learning what nsc has to offer and trying to memorize what commands and flags are available I find it very useful to have completions at hand...

Add nsc completion with subcommands for bash, fish, zsh, and powershell, using Cobra's built-in completion generators.

The completion command overrides the root's PersistentPreRunE with a no-op so that console setup, version checks, and logging bootstrap do not run—and do not contaminate stdout—when generating scripts.

Usage:

  nsc completion bash > /etc/bash_completion.d/nsc
  nsc completion fish > ~/.config/fish/completions/nsc.fish
  nsc completion zsh > "${fpath[1]}/_nsc"
  nsc completion powershell > $PROFILE.CurrentUserAllHosts

Or load in the current session:

  source <(nsc completion bash)
  nsc completion fish | source

Add `nsc completion` with subcommands for bash, fish, zsh, and
powershell, using Cobra's built-in completion generators.

The completion command overrides the root's PersistentPreRunE with a
no-op so that console setup, version checks, and logging bootstrap do
not run—and do not contaminate stdout—when generating scripts.

Usage:
  nsc completion bash > /etc/bash_completion.d/nsc
  nsc completion fish > ~/.config/fish/completions/nsc.fish
  nsc completion zsh > "${fpath[1]}/_nsc"
  nsc completion powershell > $PROFILE.CurrentUserAllHosts

Or load in the current session:
  source <(nsc completion bash)
  nsc completion fish | source
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant