diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-02-21 23:50:43 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-02-21 23:50:43 +0900 |
| commit | b5af594fec7da72b15c9a202c641af0494db6355 (patch) | |
| tree | 21f71831c8c638d14c538aebda93015e3bc484ae /crates/mozart/src/commands/completion.rs | |
| parent | 00dee137280be358ab9b40c6cff9af6efba1f17d (diff) | |
| download | php-mozart-b5af594fec7da72b15c9a202c641af0494db6355.tar.gz php-mozart-b5af594fec7da72b15c9a202c641af0494db6355.tar.zst php-mozart-b5af594fec7da72b15c9a202c641af0494db6355.zip | |
feat(completion): add shell completion generation via clap_complete
Add a `completion` subcommand that generates shell completion scripts
for Bash, Zsh, Fish, Elvish, and PowerShell using the clap_complete
crate.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart/src/commands/completion.rs')
| -rw-r--r-- | crates/mozart/src/commands/completion.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/crates/mozart/src/commands/completion.rs b/crates/mozart/src/commands/completion.rs new file mode 100644 index 0000000..406749c --- /dev/null +++ b/crates/mozart/src/commands/completion.rs @@ -0,0 +1,20 @@ +use clap::Args; +use clap::CommandFactory; +use clap_complete::aot::Shell; + +#[derive(Args)] +pub struct CompletionArgs { + /// The shell to generate completions for + #[arg(value_enum)] + pub shell: Shell, +} + +pub fn execute( + args: &CompletionArgs, + _cli: &super::Cli, + _console: &crate::console::Console, +) -> anyhow::Result<()> { + let mut cmd = super::Cli::command(); + clap_complete::aot::generate(args.shell, &mut cmd, "mozart", &mut std::io::stdout()); + Ok(()) +} |
