feat: add --generate-completion for shell tab completion
- Add clap_complete dependency for bash/zsh/fish/elvish/powershell - Add --generate-completion <shell> flag that prints completion script to stdout - profile.bash sources completions via command keep --generate-completion bash - @ and @@ aliases get completions via wrapper functions that delegate to _keep - README updated with Shell Completion section
This commit is contained in:
@@ -2,6 +2,7 @@ use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
|
||||
use clap::*;
|
||||
use clap_complete::Shell;
|
||||
|
||||
/// Main struct for command-line arguments, parsed via Clap.
|
||||
#[derive(Parser, Debug, Clone)]
|
||||
@@ -68,6 +69,10 @@ pub struct ModeArgs {
|
||||
#[arg(help("Generate default configuration and output to stdout"))]
|
||||
pub generate_config: bool,
|
||||
|
||||
#[arg(help_heading("Mode Options"), long, conflicts_with_all(["save", "get", "diff", "list", "delete", "info", "status", "server", "generate_config"]))]
|
||||
#[arg(help("Generate shell completion script (bash, zsh, fish, elvish, powershell)"))]
|
||||
pub generate_completion: Option<Shell>,
|
||||
|
||||
#[arg(help_heading("Server Options"), long, env("KEEP_SERVER_ADDRESS"))]
|
||||
#[arg(help("Server address to bind to"))]
|
||||
pub server_address: Option<String>,
|
||||
|
||||
Reference in New Issue
Block a user