use clap::{Parser, Subcommand};
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
#[arg(short, long)]
pub debug: bool,
}
#[derive(Subcommand, Debug)]
pub enum Commands {
Add {
#[arg(short, long)]
tags: Vec<String>,
#[arg(trailing_var_arg = true, required = true)]
command: Vec<String>,
},
Exec {
command_id: i64,
#[arg(long)]
debug: bool,
},
Search {
#[arg(required = true)]
query: String,
#[arg(short, long, default_value = "10")]
limit: usize,
},
Ls {
#[arg(short, long, default_value = "50")]
limit: usize,
#[arg(short = 'a', long)]
asc: bool,
},
Tag {
#[command(subcommand)]
action: TagCommands,
},
ShellInit {
#[arg(short, long)]
shell: Option<String>,
},
Delete {
#[arg(required = true)]
command_id: i64,
},
}
#[derive(Subcommand, Debug)]
pub enum TagCommands {
Add {
#[arg(required = true)]
command_id: i64,
#[arg(required = true)]
tags: Vec<String>,
},
Remove {
#[arg(required = true)]
command_id: i64,
#[arg(required = true)]
tag: String,
},
List,
Search {
#[arg(required = true)]
tag: String,
#[arg(short, long, default_value = "10")]
limit: usize,
},
}