use clap::{Args, Subcommand, ValueEnum};
#[derive(Debug, Clone, Subcommand)]
pub enum MetaCommand {
Commands(CommandsArgs),
Schema(SchemaArgs),
Version,
Manual(ManualArgs),
Completions(CompletionsArgs),
}
#[derive(Debug, Clone, Args)]
pub struct CommandsArgs {
#[arg(long)]
pub with_globals: bool,
}
#[derive(Debug, Clone, Args)]
pub struct SchemaArgs {
#[arg(long, value_name = "COMMAND")]
pub command: Option<String>,
#[arg(long, conflicts_with = "command")]
pub types: bool,
}
#[derive(Debug, Clone, Args)]
pub struct ManualArgs {}
#[derive(Debug, Clone, Args)]
pub struct CompletionsArgs {
#[arg(value_enum)]
pub shell: Option<Shell>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
#[value(rename_all = "lower")]
pub enum Shell {
Bash,
Zsh,
Fish,
Elvish,
PowerShell,
}
impl From<Shell> for clap_complete::Shell {
fn from(value: Shell) -> Self {
match value {
Shell::Bash => Self::Bash,
Shell::Zsh => Self::Zsh,
Shell::Fish => Self::Fish,
Shell::Elvish => Self::Elvish,
Shell::PowerShell => Self::PowerShell,
}
}
}