use {
crate::{
errors::ProgramError,
cli::{Args, CliShellInstallState},
},
std::{
env,
},
};
pub struct InstallLaunchArgs {
pub install: Option<bool>, pub set_install_state: Option<CliShellInstallState>, pub print_shell_function: Option<String>, }
impl InstallLaunchArgs {
pub fn from(args: &Args) -> Result<Self, ProgramError> {
let mut install = None;
if let Ok(s) = env::var("BR_INSTALL") {
if s == "yes" {
install = Some(true);
} else if s == "no" {
install = Some(false);
} else {
warn!("Unexpected value of BR_INSTALL: {:?}", s);
}
}
if args.install {
install = Some(true);
}
let print_shell_function = args.print_shell_function.clone();
let set_install_state = args.set_install_state;
Ok(Self {
install,
set_install_state,
print_shell_function,
})
}
}