use crate::args::default_subcommand::DefaultSubCmd;
use crate::args::prefs_subcommand::PrefsSubCmd;
use crate::args::settings_subcommand::SettingsSubcommand;
use crate::extensions::ExtSubcommand;
use clap::Subcommand;
#[derive(Debug, Subcommand)]
pub enum Cmd {
#[command(alias = "ls")]
List,
#[command(alias = "i")]
Install {
tag: String,
},
#[command(alias = "r")]
Run {
tag: Option<String>,
},
#[command(alias = "del")]
Uninstall {
tag: String,
},
Default {
#[clap(subcommand)]
cmd: DefaultSubCmd,
},
#[command(alias = "p")]
Prefs {
#[clap(subcommand)]
cmd: PrefsSubCmd,
},
#[command(alias = "u")]
Update,
#[command(alias = "U")]
CheckUpdate,
#[command(alias = "e")]
Extensions {
#[clap(subcommand)]
cmd: ExtSubcommand,
},
Settings {
#[clap(subcommand)]
cmd: SettingsSubcommand,
},
Locate {
tag: Option<String>,
},
}
impl Cmd {
pub fn allow_update_check(&self) -> bool {
!matches!(
self,
Self::Locate { .. } | Self::List | Self::Settings { .. } | Self::Prefs { .. }
)
}
}