---
title: completions
---

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

The `moon completions` command will generate moon 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
$ moon 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](https://github.com/scop/bash-completion).

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

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

```shell
mkdir -p ~/.bash_completions
moon completions > ~/.bash_completions/moon.sh

# In your profile
source ~/.bash_completions/moon.sh
```

</TabItem>
<TabItem value="fish">

Write the file to Fish's completions directory.

```shell
mkdir -p ~/.config/fish/completions
moon completions > ~/.config/fish/completions/moon.fish
```

</TabItem>
<TabItem value="zsh">

If using [oh-my-zsh](https://ohmyz.sh/) (the `_` prefix is required).

```shell
mkdir -p ~/.oh-my-zsh/completions
moon completions > ~/.oh-my-zsh/completions/_moon

# Reload shell (or restart terminal)
omz reload
```

</TabItem>
</Tabs>
