moon completions command generates shell completion scripts for the moon CLI, enabling tab-completion of commands, subcommands, and options in your preferred shell.
Options
--shell
Supported shells:
bash- Bash shellzsh- Zsh shellfish- Fish shellpwsh- PowerShellelvish- Elvish shellnu- Nushell
How it works
- The command detects your current shell or uses the
--shelloption - Generates the appropriate completion script for that shell
- Outputs the script to stdout (quiet mode)
- You can redirect this output to your shell’s completion directory
- Tab-completion for all moon commands
- Tab-completion for command options and flags
- Contextual suggestions based on your current command
Examples
Auto-detect and install completions
Bash
Zsh
Fish
PowerShell
Nushell
Auto-detect current shell
Test completions without installing
Unsupported shells
If you use a shell that doesn’t support completions, the command will output an error message:1.
Exit codes
0- Completions generated successfully1- Shell doesn’t support completions or generation failed