mirror of
https://git.sr.ht/~nixgoat/vento
synced 2025-11-30 08:27:17 +00:00
src: Linting and formatting
I passed the file through rustfmt and rust-clippy in order to fulfill some suggestions. Didn't do this before because I didn't have these utilities in hand, but here we go!
This commit is contained in:
parent
56c12f5d4e
commit
52a830331c
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
common,
|
common,
|
||||||
message::{append_emoji, EmojiType}
|
message::{append_emoji, EmojiType},
|
||||||
};
|
};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,9 @@ use std::env;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use vento::{
|
use vento::{
|
||||||
common::get_current_dir,
|
common::get_current_dir,
|
||||||
|
common::override_color,
|
||||||
|
help, item,
|
||||||
message::{throw_error, ErrorType},
|
message::{throw_error, ErrorType},
|
||||||
help, item, common::override_color
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,9 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use std::env;
|
use std::env;
|
||||||
use vento::{
|
use vento::{
|
||||||
|
common::override_color,
|
||||||
|
help, item,
|
||||||
message::{throw_error, ErrorType},
|
message::{throw_error, ErrorType},
|
||||||
help, item, common::override_color
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,9 @@ use anyhow::Result;
|
||||||
use std::{env, path::PathBuf};
|
use std::{env, path::PathBuf};
|
||||||
use vento::{
|
use vento::{
|
||||||
archive,
|
archive,
|
||||||
|
common::override_color,
|
||||||
|
help, history, inv,
|
||||||
message::{throw_error, ErrorType},
|
message::{throw_error, ErrorType},
|
||||||
help, history, inv, common::override_color
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use crate::message::{throw_error, ErrorType};
|
use crate::message::{throw_error, ErrorType};
|
||||||
use colored::control::set_override;
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
use colored::control::set_override;
|
||||||
use config::Config;
|
use config::Config;
|
||||||
use std::env::current_dir;
|
use std::env::current_dir;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
|
|
@ -106,15 +106,8 @@ pub fn parse_config() -> Result<DeserializedConfig> {
|
||||||
Err(_) => String::new(),
|
Err(_) => String::new(),
|
||||||
};
|
};
|
||||||
|
|
||||||
display_emoji = match settings.get_bool("display_emoji") {
|
display_emoji = settings.get_bool("display_emoji").unwrap_or(true);
|
||||||
Ok(value) => value,
|
display_colors = settings.get_bool("display_colors").unwrap_or(true);
|
||||||
Err(_) => true,
|
|
||||||
};
|
|
||||||
|
|
||||||
display_colors = match settings.get_bool("display_colors") {
|
|
||||||
Ok(value) => value,
|
|
||||||
Err(_) => true,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
common,
|
common, inv, item,
|
||||||
message::{append_emoji, throw_error, ErrorType, EmojiType},
|
message::{append_emoji, throw_error, EmojiType, ErrorType},
|
||||||
inv, item,
|
|
||||||
};
|
};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
|
|
|
||||||
14
src/inv.rs
14
src/inv.rs
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
common,
|
common,
|
||||||
message::{throw_error, append_emoji, ErrorType, EmojiType},
|
message::{append_emoji, throw_error, EmojiType, ErrorType},
|
||||||
};
|
};
|
||||||
use anyhow::{bail, Context, Result};
|
use anyhow::{bail, Context, Result};
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
|
|
@ -189,7 +189,11 @@ pub fn switch(message: bool) -> Result<()> {
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
if message {
|
if message {
|
||||||
println!("{}{}", append_emoji(EmojiType::Success)?, "Switched inventory slots!".green());
|
println!(
|
||||||
|
"{}{}",
|
||||||
|
append_emoji(EmojiType::Success)?,
|
||||||
|
"Switched inventory slots!".green()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
@ -202,6 +206,10 @@ fn create_slots() -> Result<()> {
|
||||||
fs::create_dir_all(active)?;
|
fs::create_dir_all(active)?;
|
||||||
fs::create_dir_all(inactive)?;
|
fs::create_dir_all(inactive)?;
|
||||||
|
|
||||||
println!("{}{}", append_emoji(EmojiType::Celebrate)?, "Vento has been succesfully initialized!".green());
|
println!(
|
||||||
|
"{}{}",
|
||||||
|
append_emoji(EmojiType::Celebrate)?,
|
||||||
|
"Vento has been succesfully initialized!".green()
|
||||||
|
);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
common,
|
common,
|
||||||
message::{throw_error, append_emoji, ErrorType, EmojiType},
|
message::{append_emoji, throw_error, EmojiType, ErrorType},
|
||||||
};
|
};
|
||||||
use anyhow::{bail, Result};
|
use anyhow::{bail, Result};
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@
|
||||||
|
|
||||||
pub mod archive;
|
pub mod archive;
|
||||||
pub mod common;
|
pub mod common;
|
||||||
pub mod message;
|
|
||||||
pub mod help;
|
pub mod help;
|
||||||
pub mod history;
|
pub mod history;
|
||||||
pub mod inv;
|
pub mod inv;
|
||||||
pub mod item;
|
pub mod item;
|
||||||
|
pub mod message;
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,9 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use crate::common::parse_config;
|
||||||
use anyhow::{bail, Result};
|
use anyhow::{bail, Result};
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
use crate::common::parse_config;
|
|
||||||
|
|
||||||
pub enum ErrorType {
|
pub enum ErrorType {
|
||||||
TooManyArgs,
|
TooManyArgs,
|
||||||
|
|
@ -43,10 +43,9 @@ pub enum EmojiType {
|
||||||
Inventory,
|
Inventory,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn append_emoji(message: EmojiType) -> Result<String> {
|
pub fn append_emoji(message: EmojiType) -> Result<String> {
|
||||||
let mut output: String = String::new();
|
let mut output: String = String::new();
|
||||||
|
|
||||||
if parse_config()?.display_emoji {
|
if parse_config()?.display_emoji {
|
||||||
match message {
|
match message {
|
||||||
EmojiType::Celebrate => output = String::from("🎉 "),
|
EmojiType::Celebrate => output = String::from("🎉 "),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue