mirror of
https://git.sr.ht/~nixgoat/vento
synced 2024-11-23 15:25:19 +00:00
Compare commits
No commits in common. "b9cea29592f646ed827bfc233c41290295638aad" and "b627d304d8a8d78f9659726bbc8a711127d06a06" have entirely different histories.
b9cea29592
...
b627d304d8
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -592,7 +592,7 @@ checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf"
|
|||
|
||||
[[package]]
|
||||
name = "vento"
|
||||
version = "1.0.4"
|
||||
version = "1.0.3"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"colored",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "vento"
|
||||
version = "1.0.4"
|
||||
version = "1.0.3"
|
||||
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 &pages {
|
||||
let tempfile = tempdir.join(page.clone().1);
|
||||
for page in 0..pages.len() {
|
||||
let tempfile = tempdir.join(pages[page].clone().1);
|
||||
let mut file = File::create(tempfile).unwrap();
|
||||
write!(&mut file, "{}", page.clone().0).unwrap();
|
||||
write!(&mut file, "{}", pages[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();
|
||||
let vento_dir: PathBuf = if custom_dir != PathBuf::new() {
|
||||
Path::new(&custom_dir).to_path_buf()
|
||||
if custom_dir != PathBuf::new() {
|
||||
vento_dir = Path::new(&custom_dir).to_path_buf();
|
||||
} else {
|
||||
[home, Path::new(".vento").to_path_buf()].iter().collect()
|
||||
};
|
||||
|
||||
vento_dir = [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!("⚠️ {} 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());
|
||||
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) ");
|
||||
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.is_empty() {
|
||||
if dir != "" {
|
||||
// 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" => slot.bold(),
|
||||
_ => slot.blue().bold(),
|
||||
"active" => format!("{}", slot).bold(),
|
||||
"inactive" | _ => format!("{}", slot).blue().bold(),
|
||||
},
|
||||
if !dir.is_empty() {
|
||||
if dir != "" {
|
||||
if cfg!(windows) {
|
||||
format!("\\{}", dir)
|
||||
format!("\\{}", dir.to_string())
|
||||
} else {
|
||||
format!("/{}", dir)
|
||||
format!("/{}", dir.to_string())
|
||||
}
|
||||
} else {
|
||||
"".to_string()
|
||||
|
@ -116,14 +116,14 @@ pub fn list(slot: &str, dir: &str) -> Result<()> {
|
|||
format!(
|
||||
"Files in {}{} ({}):",
|
||||
match slot {
|
||||
"active" => slot.bold(),
|
||||
_ => slot.blue().bold(),
|
||||
"active" => format!("{}", slot).bold(),
|
||||
"inactive" | _ => format!("{}", slot).blue().bold(),
|
||||
},
|
||||
if !dir.is_empty() {
|
||||
if dir != "" {
|
||||
if cfg!(windows) {
|
||||
format!("\\{}", dir)
|
||||
format!("\\{}", dir.to_string())
|
||||
} else {
|
||||
format!("/{}", dir)
|
||||
format!("/{}", dir.to_string())
|
||||
}
|
||||
} else {
|
||||
" inventory".to_string()
|
||||
|
@ -158,7 +158,7 @@ pub fn list(slot: &str, dir: &str) -> Result<()> {
|
|||
SizeFormatterBinary::new(file.clone().metadata().unwrap().len())
|
||||
)
|
||||
} else {
|
||||
String::new()
|
||||
format!("")
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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: &str) -> Result<()> {
|
||||
pub fn take(file: &String, slot: &String) -> Result<()> {
|
||||
// Takes a file or directory
|
||||
let ventodir = &common::env_config()?[0];
|
||||
|
||||
|
@ -35,7 +35,7 @@ pub fn take(file: &String, slot: &str) -> Result<()> {
|
|||
"Vento not initialized. Run \"vento -i\" to initialize Vento.".red()
|
||||
);
|
||||
};
|
||||
let slotdir: PathBuf = match slot {
|
||||
let slotdir: PathBuf = match slot.as_str() {
|
||||
"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: &str) -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn drop(file: &String, slot: &str, dest: PathBuf) -> Result<()> {
|
||||
pub fn drop(file: &String, slot: &String, dest: PathBuf) -> Result<()> {
|
||||
// Drops a file or directory
|
||||
let ventodir = &common::env_config()?[0];
|
||||
|
||||
|
@ -104,7 +104,7 @@ pub fn drop(file: &String, slot: &str, dest: PathBuf) -> Result<()> {
|
|||
);
|
||||
};
|
||||
|
||||
let slotdir: PathBuf = match slot {
|
||||
let slotdir: PathBuf = match slot.as_str() {
|
||||
"active" | "a" => common::env_config()?[1].clone(),
|
||||
"inactive" | "i" => common::env_config()?[2].clone(),
|
||||
_ => PathBuf::new(),
|
||||
|
|
Loading…
Reference in a new issue