mirror of https://git.sr.ht/~nixgoat/vento
Compare commits
2 Commits
b6162a9dcb
...
c5cc1ea97a
Author | SHA1 | Date |
---|---|---|
Lux Aliaga | c5cc1ea97a | |
Lux Aliaga | faf8036b19 |
|
@ -40,9 +40,9 @@ pub fn export_inv(slot: &str, output: PathBuf, message: bool) -> Result<()> {
|
||||||
"✅ {} {} {} {}",
|
"✅ {} {} {} {}",
|
||||||
"Exported".green(),
|
"Exported".green(),
|
||||||
match slot {
|
match slot {
|
||||||
"a" => "active",
|
"a" | "active" => "active".green(),
|
||||||
"i" => "inactive",
|
"i" | "inactive" => "inactive".blue(),
|
||||||
_ => &slot,
|
_ => slot.red(),
|
||||||
}
|
}
|
||||||
.bold(),
|
.bold(),
|
||||||
"slot into".green(),
|
"slot into".green(),
|
||||||
|
@ -51,3 +51,21 @@ pub fn export_inv(slot: &str, output: PathBuf, message: bool) -> Result<()> {
|
||||||
};
|
};
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn export_install(output: PathBuf, message: bool) -> Result<()> {
|
||||||
|
let dir: PathBuf = common::env_config()?.vento_dir;
|
||||||
|
|
||||||
|
let archive = File::create(&output)?;
|
||||||
|
let enc = XzEncoder::new(archive, 9);
|
||||||
|
let mut tar = tar::Builder::new(enc);
|
||||||
|
tar.append_dir_all("", dir)?;
|
||||||
|
|
||||||
|
if message {
|
||||||
|
println!(
|
||||||
|
"✅ {} {}",
|
||||||
|
"Exported Vento install into".green(),
|
||||||
|
&output.to_str().unwrap()
|
||||||
|
);
|
||||||
|
};
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
|
@ -60,6 +60,11 @@ fn main() -> Result<()> {
|
||||||
2 => archive::export_inv("active", PathBuf::from("active.tar.xz"), true)?,
|
2 => archive::export_inv("active", PathBuf::from("active.tar.xz"), true)?,
|
||||||
_ => throw_error(ErrorType::TooManyArgs)?,
|
_ => throw_error(ErrorType::TooManyArgs)?,
|
||||||
},
|
},
|
||||||
|
"-E" | "--export-install" => match args.len() {
|
||||||
|
3 => archive::export_install(PathBuf::from(&args[2]), true)?,
|
||||||
|
2 => archive::export_install(PathBuf::from("vento.tar.xz"), true)?,
|
||||||
|
_ => throw_error(ErrorType::TooManyArgs)?,
|
||||||
|
},
|
||||||
"-s" => match args.len() {
|
"-s" => match args.len() {
|
||||||
4 => inv::list(&args[2], &args[3])?,
|
4 => inv::list(&args[2], &args[3])?,
|
||||||
3 => inv::list(&args[2], "")?,
|
3 => inv::list(&args[2], "")?,
|
||||||
|
|
Loading…
Reference in New Issue