Shell completions for neo
The neo CLI can print a completion script for your shell:
neo completion <shell><shell> is one of bash, zsh, fish, elvish or powershell. The script
goes to stdout — it is never installed as a side effect, so you choose where it
lands.
The scripts are generated from the CLI’s own command tree, so they cover every
subcommand and flag the binary you are running actually has. They cannot drift
from --help, and a completion script from an older neo is simply an older
command set — regenerate after upgrading.
Needs the bash-completion package.
mkdir -p ~/.local/share/bash-completion/completionsneo completion bash > ~/.local/share/bash-completion/completions/neoOpen a new shell. For a system-wide install, write to
/usr/share/bash-completion/completions/neo instead.
The file must be named _neo and live in a directory on $fpath:
mkdir -p ~/.local/share/zsh/site-functionsneo completion zsh > ~/.local/share/zsh/site-functions/_neoIf that directory is not already on $fpath, add this to ~/.zshrc before
compinit runs:
fpath=(~/.local/share/zsh/site-functions $fpath)autoload -Uz compinit && compinitzsh caches completion definitions; run rm -f ~/.zcompdump && compinit after
replacing the file.
mkdir -p ~/.config/fish/completionsneo completion fish > ~/.config/fish/completions/neo.fishfish picks it up in new shells with no further configuration.
elvish
Section titled “elvish”mkdir -p ~/.config/elvish/libneo completion elvish > ~/.config/elvish/lib/neo.elvThen add use neo to ~/.config/elvish/rc.elv.
PowerShell
Section titled “PowerShell”Append the script to your profile:
neo completion powershell | Out-String | Invoke-ExpressionTo make it permanent, add that line to the file $PROFILE points at
(New-Item -Type File -Force $PROFILE creates it if it does not exist).
Keeping completions current
Section titled “Keeping completions current”Completions are a snapshot of the command tree at the moment you generated
them. Regenerate whenever you upgrade neo:
neo completion zsh > ~/.local/share/zsh/site-functions/_neoRe-running the installer does this for bash, zsh and fish automatically, so an
upgrade through get.neosource.dev needs no manual step.