Summary
opendotsync has no shell completions. Users must remember subcommand names and flags manually. Since the CLI is built with clap, completions are essentially free.
Implementation
Add a hidden completions <shell> subcommand using clap_complete:
# Cargo.toml
[dependencies]
clap_complete = "4"
// src/cli.rs
#[derive(Subcommand)]
pub enum Command {
// ...
/// Generate shell completions
#[command(hide = true)]
Completions { shell: clap_complete::Shell },
}
// src/main.rs dispatch
cli::Command::Completions { shell } => {
clap_complete::generate(shell, &mut Cli::command(), "opendotsync", &mut std::io::stdout());
Ok(())
}
Users install with:
# bash
opendotsync completions bash >> ~/.bashrc
# zsh
opendotsync completions zsh > ~/.zfunc/_opendotsync
# fish
opendotsync completions fish > ~/.config/fish/completions/opendotsync.fish
Affected Files
Cargo.toml — add clap_complete
src/cli.rs — add Completions variant
src/main.rs — wire dispatch
Summary
opendotsync has no shell completions. Users must remember subcommand names and flags manually. Since the CLI is built with
clap, completions are essentially free.Implementation
Add a hidden
completions <shell>subcommand usingclap_complete:Users install with:
Affected Files
Cargo.toml— addclap_completesrc/cli.rs— addCompletionsvariantsrc/main.rs— wire dispatch