---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://sourcecraft.dev/portal/docs/en/cli-ref/src-completion.md
  - https://sourcecraft.dev/portal/docs/ru/cli-ref/src-completion.md
---
> **Documentation Index:** Fetch the complete configuration index at https://sourcecraft.dev/portal/docs/en/llms.txt

# src completion

Generate shell completion scripts for src.

To load completions:

Bash:
$ source <(src completion bash)

# To load completions for each session, execute once:
# Linux:
$ src completion bash > /etc/bash_completion.d/src
# macOS:
$ src completion bash > $(brew --prefix)/etc/bash_completion.d/src

Zsh:
# If shell completion is not already enabled in your environment,
# you will need to enable it. You can execute the following once:
$ echo "autoload -U compinit; compinit" >> ~/.zshrc

# To load completions for each session, execute once:
$ sc completion zsh > "${fpath[1]}/_sc"

# You will need to start a new shell for this setup to take effect.

Fish:
$ sc completion fish | source

# To load completions for each session, execute once:
$ sc completion fish > ~/.config/fish/completions/sc.fish

## Usage

`src completion <shell> [flags]`

### Available commands

| Command | Description |
| --- | --- |
| [bash](src-completion-bash.md) | Generate bash completion script |
| [fish](src-completion-fish.md) | Generate fish completion script |
| [zsh](src-completion-zsh.md) | Generate zsh completion script |

### Inherited flags

| Flag | Description |
| --- | --- |
| `--env string` | Override Sourcecraft environment (use 'src envs' to list available) |
| `--json string` | Output JSON, optionally filtered (--json or --json=field1,field2) |
| `--json-compact string` | Output compact JSON, optionally filtered |
| `-R, --repo string` | Select another repository using OWNER/REPO format |
| `-V, --verbose` | Enable debug logging output |

### Learn more

Use `src completion <subcommand> --help` for more information about a command.
