use clap::{Parser, ValueEnum};
use crate::{channel::Component, profile::Profile};
pub const DEFAULT_USER_DATA_DIR: &str = "XDG_DATA_HOME";
#[derive(Default, Debug, Parser, Clone)]
pub struct InstallationOptions {
#[arg(long, short, default_value = "minimal")]
pub profile: Profile,
#[arg(long, short, default_value = "false")]
pub verbose: bool,
#[arg(skip)]
pub components_to_uninstall: Vec<Component>,
}
#[derive(Default, Debug, Parser, Clone, Copy)]
pub struct UpdateOptions {
#[clap(long, short, default_value = "false")]
pub verbose: bool,
#[clap(value_enum, short, long, default_value = "off")]
pub path_update: PathUpdate,
}
#[derive(Default, Debug, Parser, Clone, Copy, ValueEnum)]
pub enum PathUpdate {
#[default]
Off,
All,
Interactive,
}
impl From<InstallationOptions> for UpdateOptions {
fn from(value: InstallationOptions) -> Self {
UpdateOptions {
verbose: value.verbose,
..Default::default()
}
}
}
impl From<UpdateOptions> for InstallationOptions {
fn from(value: UpdateOptions) -> Self {
InstallationOptions {
profile: Profile::Minimal,
verbose: value.verbose,
components_to_uninstall: Vec::new(),
}
}
}