mirror of
https://git.sr.ht/~nixgoat/vento
synced 2024-11-23 07:14:27 +00:00
Compare commits
2 commits
b627d304d8
...
b9cea29592
Author | SHA1 | Date | |
---|---|---|---|
Lux Aliaga | b9cea29592 | ||
Lux Aliaga | 4712c67bc2 |
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -592,7 +592,7 @@ checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf"
|
|||
|
||||
[[package]]
|
||||
name = "vento"
|
||||
version = "1.0.3"
|
||||
version = "1.0.4"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"colored",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "vento"
|
||||
version = "1.0.3"
|
||||
version = "1.0.4"
|
||||
edition = "2021"
|
||||
readme = "README.md"
|
||||
|
||||
|
|
6
build.rs
6
build.rs
|
@ -31,10 +31,10 @@ fn main() -> Result<()> {
|
|||
|
||||
create_dir_all(tempdir.clone())?;
|
||||
|
||||
for page in 0..pages.len() {
|
||||
let tempfile = tempdir.join(pages[page].clone().1);
|
||||
for page in &pages {
|
||||
let tempfile = tempdir.join(page.clone().1);
|
||||
let mut file = File::create(tempfile).unwrap();
|
||||
write!(&mut file, "{}", pages[page].clone().0).unwrap();
|
||||
write!(&mut file, "{}", page.clone().0).unwrap();
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
|
|
@ -31,13 +31,13 @@ pub fn env_config() -> Result<Vec<PathBuf>> {
|
|||
if home == PathBuf::new() {
|
||||
bail!("{}", "Vento was unable to detect your home folder. Have you configured your environment correctly?".red());
|
||||
};
|
||||
let vento_dir: PathBuf;
|
||||
let custom_dir = Path::new(&dir_config()?).to_path_buf();
|
||||
if custom_dir != PathBuf::new() {
|
||||
vento_dir = Path::new(&custom_dir).to_path_buf();
|
||||
let vento_dir: PathBuf = if custom_dir != PathBuf::new() {
|
||||
Path::new(&custom_dir).to_path_buf()
|
||||
} else {
|
||||
vento_dir = [home, Path::new(".vento").to_path_buf()].iter().collect();
|
||||
}
|
||||
[home, Path::new(".vento").to_path_buf()].iter().collect()
|
||||
};
|
||||
|
||||
let active_dir = [&vento_dir, &Path::new("active").to_path_buf()]
|
||||
.iter()
|
||||
.collect();
|
||||
|
@ -56,7 +56,7 @@ fn dir_config() -> Result<String> {
|
|||
_ => PathBuf::new(),
|
||||
};
|
||||
|
||||
if &config != &PathBuf::new() {
|
||||
if config != PathBuf::new() {
|
||||
config.push("vento.toml");
|
||||
if config.is_file() {
|
||||
let settings = Config::builder()
|
||||
|
|
26
src/inv.rs
26
src/inv.rs
|
@ -32,7 +32,7 @@ pub fn init() -> Result<()> {
|
|||
if ventodir.is_dir() {
|
||||
// Checks if Vento has already been initialized and prompts the user if they want to initialize it again
|
||||
let mut answer = String::new();
|
||||
print!("⚠️ {} {}", "WARNING:".bold().red(), "Vento has already been initialized. Reinitializing will delete all files on the directory for Vento. Do you wish to proceed? (y/N) ");
|
||||
print!("⚠️ {} Vento has already been initialized. Reinitializing will delete all files on the directory for Vento. Do you wish to proceed? (y/N) ", "WARNING:".bold().red());
|
||||
let _ = io::stdout().flush();
|
||||
io::stdin()
|
||||
.read_line(&mut answer)
|
||||
|
@ -65,7 +65,7 @@ pub fn list(slot: &str, dir: &str) -> Result<()> {
|
|||
_ => PathBuf::new(),
|
||||
};
|
||||
|
||||
if dir != "" {
|
||||
if !dir.is_empty() {
|
||||
// Detects if the directory argument is not empty, and if so appends the path provided to the slot directory variable
|
||||
slotdir = [&slotdir, &Path::new(dir).to_path_buf()].iter().collect();
|
||||
}
|
||||
|
@ -95,14 +95,14 @@ pub fn list(slot: &str, dir: &str) -> Result<()> {
|
|||
format!(
|
||||
"No files in {}{}.",
|
||||
match slot {
|
||||
"active" => format!("{}", slot).bold(),
|
||||
"inactive" | _ => format!("{}", slot).blue().bold(),
|
||||
"active" => slot.bold(),
|
||||
_ => slot.blue().bold(),
|
||||
},
|
||||
if dir != "" {
|
||||
if !dir.is_empty() {
|
||||
if cfg!(windows) {
|
||||
format!("\\{}", dir.to_string())
|
||||
format!("\\{}", dir)
|
||||
} else {
|
||||
format!("/{}", dir.to_string())
|
||||
format!("/{}", dir)
|
||||
}
|
||||
} else {
|
||||
"".to_string()
|
||||
|
@ -116,14 +116,14 @@ pub fn list(slot: &str, dir: &str) -> Result<()> {
|
|||
format!(
|
||||
"Files in {}{} ({}):",
|
||||
match slot {
|
||||
"active" => format!("{}", slot).bold(),
|
||||
"inactive" | _ => format!("{}", slot).blue().bold(),
|
||||
"active" => slot.bold(),
|
||||
_ => slot.blue().bold(),
|
||||
},
|
||||
if dir != "" {
|
||||
if !dir.is_empty() {
|
||||
if cfg!(windows) {
|
||||
format!("\\{}", dir.to_string())
|
||||
format!("\\{}", dir)
|
||||
} else {
|
||||
format!("/{}", dir.to_string())
|
||||
format!("/{}", dir)
|
||||
}
|
||||
} else {
|
||||
" inventory".to_string()
|
||||
|
@ -158,7 +158,7 @@ pub fn list(slot: &str, dir: &str) -> Result<()> {
|
|||
SizeFormatterBinary::new(file.clone().metadata().unwrap().len())
|
||||
)
|
||||
} else {
|
||||
format!("")
|
||||
String::new()
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ use fs_extra::dir::{move_dir, CopyOptions};
|
|||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
pub fn take(file: &String, slot: &String) -> Result<()> {
|
||||
pub fn take(file: &String, slot: &str) -> Result<()> {
|
||||
// Takes a file or directory
|
||||
let ventodir = &common::env_config()?[0];
|
||||
|
||||
|
@ -35,7 +35,7 @@ pub fn take(file: &String, slot: &String) -> Result<()> {
|
|||
"Vento not initialized. Run \"vento -i\" to initialize Vento.".red()
|
||||
);
|
||||
};
|
||||
let slotdir: PathBuf = match slot.as_str() {
|
||||
let slotdir: PathBuf = match slot {
|
||||
"active" | "a" => common::env_config()?[1].clone(),
|
||||
"inactive" | "i" => common::env_config()?[2].clone(),
|
||||
_ => PathBuf::new(),
|
||||
|
@ -92,7 +92,7 @@ pub fn take(file: &String, slot: &String) -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn drop(file: &String, slot: &String, dest: PathBuf) -> Result<()> {
|
||||
pub fn drop(file: &String, slot: &str, dest: PathBuf) -> Result<()> {
|
||||
// Drops a file or directory
|
||||
let ventodir = &common::env_config()?[0];
|
||||
|
||||
|
@ -104,7 +104,7 @@ pub fn drop(file: &String, slot: &String, dest: PathBuf) -> Result<()> {
|
|||
);
|
||||
};
|
||||
|
||||
let slotdir: PathBuf = match slot.as_str() {
|
||||
let slotdir: PathBuf = match slot {
|
||||
"active" | "a" => common::env_config()?[1].clone(),
|
||||
"inactive" | "i" => common::env_config()?[2].clone(),
|
||||
_ => PathBuf::new(),
|
||||
|
|
Loading…
Reference in a new issue