Back to Moon

completions

website/docs/proto/commands/completions.mdx

2.2.41.4 KB
Original Source

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

The proto completions command will generate proto command and argument completions for your current shell. This command will write to stdout, which can then be redirected to a file of your choice.

shell
$ proto completions > ./path/to/write/to

Options

  • --shell - Shell to explicitly generate for.

Examples

<Tabs groupId="comp" defaultValue="bash" values={[ { label: 'Bash', value: 'bash' }, { label: 'Fish', value: 'fish' }, { label: 'Zsh', value: 'zsh' }, ]}

<TabItem value="bash">

If using bash-completion.

shell
mkdir -p ~/.bash_completion.d
proto completions > ~/.bash_completion.d/proto.sh

Otherwise write the file to a common location, and source it in your profile.

shell
mkdir -p ~/.bash_completions
proto completions > ~/.bash_completions/proto.sh

# In your profile
source ~/.bash_completions/proto.sh
</TabItem> <TabItem value="fish">

Write the file to Fish's completions directory.

shell
mkdir -p ~/.config/fish/completions
proto completions > ~/.config/fish/completions/proto.fish
</TabItem> <TabItem value="zsh">

If using oh-my-zsh (the _ prefix is required).

shell
mkdir -p ~/.oh-my-zsh/completions
proto completions > ~/.oh-my-zsh/completions/_proto

# Reload shell (or restart terminal)
omz reload
</TabItem> </Tabs>