LPM-cli

lpm completions

Generate a shell completion script for bash, zsh, fish, PowerShell, or elvish.

lpm completions <shell>

Emits a clap-driven completion script for the given shell to stdout. Pipe the output into your shell's completion-load path and lpm <TAB> will start completing subcommands, flags, and value-enums.

The script is generated from the live CLI definition, so it stays in sync with the binary at every release — no separately maintained completion files to drift out of date.

Supported shells

ShellArgumentTypical install path
Bashbash/etc/bash_completion.d/lpm (system) or ~/.local/share/bash-completion/completions/lpm (user)
ZshzshA directory in $fpath, e.g. ${fpath[1]}/_lpm or ~/.zfunc/_lpm
Fishfish~/.config/fish/completions/lpm.fish
PowerShellpowershellSourced from $PROFILE via Invoke-Expression
ElvishelvishSource from ~/.config/elvish/rc.elv

Examples

# Zsh — point fpath at a user dir, generate, restart the shell
mkdir -p ~/.zfunc && lpm completions zsh > ~/.zfunc/_lpm
echo 'fpath=(~/.zfunc $fpath)' >> ~/.zshrc
echo 'autoload -Uz compinit && compinit' >> ~/.zshrc

# Bash (system-wide, requires sudo)
lpm completions bash | sudo tee /etc/bash_completion.d/lpm > /dev/null

# Bash (per-user)
mkdir -p ~/.local/share/bash-completion/completions
lpm completions bash > ~/.local/share/bash-completion/completions/lpm

# Fish
lpm completions fish > ~/.config/fish/completions/lpm.fish

# PowerShell — append to your profile
lpm completions powershell | Out-String | Invoke-Expression
# Or, persistently:
lpm completions powershell >> $PROFILE

Flags

lpm completions takes the target shell as a positional argument and otherwise has no specific flags. The global flags (--json, --verbose, etc.) do not affect the generated script.

See also

  • lpm self-update — keep the binary current so completions reflect the latest commands
  • Installation — get LPM installed before generating completions