use std::path::PathBuf;
use clap::Parser;
use clap_complete::Shell;
use crate::configuration::ConfigCommand;
use crate::the_way::filter::Filters;
#[derive(Debug, Parser)]
#[command(name = "the-way", author, version, about, long_about)]
pub struct TheWayCLI {
#[clap(short, long)]
pub colorize: bool,
#[clap(short, long, conflicts_with = "colorize")]
pub plain: bool,
#[clap(subcommand)]
pub cmd: TheWaySubcommand,
}
#[derive(Debug, Parser)]
pub enum TheWaySubcommand {
New,
Cmd {
code: Option<String>,
},
Search {
#[clap(flatten)]
filters: Filters,
#[clap(long, short)]
stdout: bool,
#[clap(long, short)]
exact: bool,
},
Sync {
#[clap(subcommand)]
cmd: SyncCommand,
#[clap(long, short)]
force: bool,
},
List {
#[clap(flatten)]
filters: Filters,
},
Import {
file: Option<PathBuf>,
#[clap(long, short, value_name = "URL")]
gist_url: Option<String>,
#[clap(long, short = 'w', conflicts_with = "gist_url", value_name = "URL")]
the_way_url: Option<String>,
},
Export {
file: Option<PathBuf>,
#[clap(flatten)]
filters: Filters,
},
Clear {
#[clap(long, short)]
force: bool,
},
Complete {
#[clap(value_enum)]
shell: Shell,
},
Themes {
#[clap(subcommand)]
cmd: ThemeCommand,
},
#[clap(alias = "configure")]
Config {
#[clap(subcommand)]
cmd: ConfigCommand,
},
Edit {
index: usize,
},
#[clap(alias = "delete")]
Del {
index: usize,
#[clap(long, short)]
force: bool,
},
#[clap(alias = "copy")]
Cp {
index: usize,
#[clap(long, short)]
stdout: bool,
},
View {
index: usize,
},
}
#[derive(Parser, Debug)]
pub enum ThemeCommand {
Set { theme: Option<String> },
Add {
file: PathBuf,
},
Language {
file: PathBuf,
},
Get,
}
#[derive(Parser, Debug, Eq, PartialEq)]
pub enum SyncCommand {
Date,
Local,
Gist,
}