Skip to content

flaglint completion

flaglint completion prints a shell completion script to stdout. Source it once and your shell will tab-complete subcommands, flags, and flag values (format choices, shell names, and more).

Terminal window
flaglint completion <shell>

Supported shells: bash, zsh, fish.

Load for the current session only:

Terminal window
source <(flaglint completion bash)

Load permanently (add to ~/.bashrc or ~/.bash_profile):

Terminal window
flaglint completion bash >> ~/.bash_completion

Load for the current session only:

Terminal window
source <(flaglint completion zsh)

Load permanently (requires ~/.zsh/completions in your $fpath):

Terminal window
mkdir -p ~/.zsh/completions
flaglint completion zsh > ~/.zsh/completions/_flaglint

Then ensure $fpath includes the directory before compinit runs — add to ~/.zshrc:

Terminal window
fpath=(~/.zsh/completions $fpath)
autoload -Uz compinit && compinit
Terminal window
flaglint completion fish > ~/.config/fish/completions/flaglint.fish

Fish auto-sources files in ~/.config/fish/completions/ on startup — no extra configuration needed.

  • Subcommandsaudit, scan, migrate, validate, init, completion
  • Flags — all per-command flags and global flags (--quiet, --verbose)
  • Flag values--format values (json, markdown, html, sarif, text), completion shell names (bash, zsh, fish)
  • File arguments--output, --config, --baseline, --write-baseline complete against the filesystem
Terminal window
# Print the bash completion script
flaglint completion bash
# Activate immediately in the current bash session
source <(flaglint completion bash)
# Write the zsh completion script to the standard completions directory
flaglint completion zsh > ~/.zsh/completions/_flaglint
# Write the fish completion file
flaglint completion fish > ~/.config/fish/completions/flaglint.fish
CodeMeaning
0Script printed successfully.
2No shell argument provided, or unsupported shell name.