From 078b047e04c5c2d6aafcb4e07cc9c96cdd72bcf0 Mon Sep 17 00:00:00 2001 From: Awiteb Date: Mon, 18 Mar 2024 23:45:39 +0300 Subject: [PATCH] change: Change 'password manager' to 'vault manager' --- src/cli/add_command.rs | 2 +- src/cli/clean_command.rs | 6 +++--- src/cli/edit_command.rs | 6 +++--- src/cli/export_command.rs | 8 ++++---- src/cli/gen_command.rs | 4 ++-- src/cli/import_command.rs | 6 +++--- src/cli/list_command.rs | 6 +++--- src/cli/mod.rs | 4 ++-- src/cli/remove_command.rs | 10 +++++----- src/errors.rs | 2 +- src/macros.rs | 10 +++++----- src/main.rs | 2 +- src/traits.rs | 4 ++-- src/utils.rs | 2 +- src/vault/cipher.rs | 2 +- src/vault/validator.rs | 2 +- 16 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/cli/add_command.rs b/src/cli/add_command.rs index 8bd052f..7b5a5c9 100644 --- a/src/cli/add_command.rs +++ b/src/cli/add_command.rs @@ -1,4 +1,4 @@ -// Lprs - A local CLI password manager +// Lprs - A local CLI vault manager // Copyright (C) 2024 Awiteb // // This program is free software: you can redistribute it and/or modify diff --git a/src/cli/clean_command.rs b/src/cli/clean_command.rs index 683fa9d..2efeed3 100644 --- a/src/cli/clean_command.rs +++ b/src/cli/clean_command.rs @@ -1,4 +1,4 @@ -// Lprs - A local CLI password manager +// Lprs - A local CLI vault manager // Copyright (C) 2024 Awiteb // // This program is free software: you can redistribute it and/or modify @@ -28,7 +28,7 @@ use crate::{ pub struct Clean {} impl RunCommand for Clean { - fn run(&self, password_manager: Vaults) -> LprsResult<()> { - fs::write(password_manager.vaults_file, "[]").map_err(LprsError::Io) + fn run(&self, vault_manager: Vaults) -> LprsResult<()> { + fs::write(vault_manager.vaults_file, "[]").map_err(LprsError::Io) } } diff --git a/src/cli/edit_command.rs b/src/cli/edit_command.rs index df99815..d8cdd88 100644 --- a/src/cli/edit_command.rs +++ b/src/cli/edit_command.rs @@ -1,4 +1,4 @@ -// Lprs - A local CLI password manager +// Lprs - A local CLI vault manager // Copyright (C) 2024 Awiteb // // This program is free software: you can redistribute it and/or modify @@ -47,7 +47,7 @@ pub struct Edit { } impl RunCommand for Edit { - fn run(&self, mut password_manager: Vaults) -> LprsResult<()> { + fn run(&self, mut vault_manager: Vaults) -> LprsResult<()> { let index = self.index.get() as usize; if let Some(vault) = vault_manager.vaults.get_mut(index - 1) { @@ -74,7 +74,7 @@ impl RunCommand for Edit { Err(LprsError::InvalidVaultIndex(format!( "The index `{}` is greater than the vaults count {}", self.index, - password_manager.vaults.len() + vault_manager.vaults.len() ))) } } diff --git a/src/cli/export_command.rs b/src/cli/export_command.rs index 555b214..1375ebb 100644 --- a/src/cli/export_command.rs +++ b/src/cli/export_command.rs @@ -1,4 +1,4 @@ -// Lprs - A local CLI password manager +// Lprs - A local CLI vault manager // Copyright (C) 2024 Awiteb // // This program is free software: you can redistribute it and/or modify @@ -34,7 +34,7 @@ pub struct Export { } impl RunCommand for Export { - fn run(&self, password_manager: Vaults) -> LprsResult<()> { + fn run(&self, vault_manager: Vaults) -> LprsResult<()> { if self .path .extension() @@ -43,10 +43,10 @@ impl RunCommand for Export { if !self.path.exists() { let exported_data = match self.format { Format::Lprs => serde_json::to_string::>>( - &password_manager.encrypt_vaults()?, + &vault_manager.encrypt_vaults()?, ), Format::BitWarden => { - serde_json::to_string(&BitWardenPasswords::from(password_manager)) + serde_json::to_string(&BitWardenPasswords::from(vault_manager)) } }?; diff --git a/src/cli/gen_command.rs b/src/cli/gen_command.rs index 41b5c54..d5dacac 100644 --- a/src/cli/gen_command.rs +++ b/src/cli/gen_command.rs @@ -1,4 +1,4 @@ -// Lprs - A local CLI password manager +// Lprs - A local CLI vault manager // Copyright (C) 2024 Awiteb // // This program is free software: you can redistribute it and/or modify @@ -45,7 +45,7 @@ pub struct Gen { } impl RunCommand for Gen { - fn run(&self, _password_manager: Vaults) -> LprsResult<()> { + fn run(&self, _vault_manager: Vaults) -> LprsResult<()> { if self.uppercase || self.lowercase || self.numbers || self.symbols { println!( "{}", diff --git a/src/cli/import_command.rs b/src/cli/import_command.rs index 4e559dd..cbc080a 100644 --- a/src/cli/import_command.rs +++ b/src/cli/import_command.rs @@ -1,4 +1,4 @@ -// Lprs - A local CLI password manager +// Lprs - A local CLI vault manager // Copyright (C) 2024 Awiteb // // This program is free software: you can redistribute it and/or modify @@ -35,7 +35,7 @@ pub struct Import { } impl RunCommand for Import { - fn run(&self, mut password_manager: Vaults) -> LprsResult<()> { + fn run(&self, mut vault_manager: Vaults) -> LprsResult<()> { if self.path.exists() { if self .path @@ -46,7 +46,7 @@ impl RunCommand for Import { Format::Lprs => { let vaults = Vaults::try_reload( self.path.to_path_buf(), - password_manager.master_password.to_vec(), + vault_manager.master_password.to_vec(), )?; let vaults_len = vaults.vaults.len(); diff --git a/src/cli/list_command.rs b/src/cli/list_command.rs index e36609f..a7550c9 100644 --- a/src/cli/list_command.rs +++ b/src/cli/list_command.rs @@ -1,4 +1,4 @@ -// Lprs - A local CLI password manager +// Lprs - A local CLI vault manager // Copyright (C) 2024 Awiteb // // This program is free software: you can redistribute it and/or modify @@ -52,8 +52,8 @@ pub struct List { } impl RunCommand for List { - fn run(&self, password_manager: Vaults) -> LprsResult<()> { - if password_manager.vaults.is_empty() { + fn run(&self, vault_manager: Vaults) -> LprsResult<()> { + if vault_manager.vaults.is_empty() { Err(LprsError::Other( "Looks like there is no passwords to list".to_owned(), )) diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 1221ebb..d76a89d 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -1,4 +1,4 @@ -// Lprs - A local CLI password manager +// Lprs - A local CLI vault manager // Copyright (C) 2024 Awiteb // // This program is free software: you can redistribute it and/or modify @@ -92,7 +92,7 @@ impl Cli { master_password.into_bytes().into_iter().take(32).collect(), )? }; - self.command.run(password_manager)?; + self.command.run(vault_manager)?; Ok(()) } diff --git a/src/cli/remove_command.rs b/src/cli/remove_command.rs index 331cd21..29ac6b6 100644 --- a/src/cli/remove_command.rs +++ b/src/cli/remove_command.rs @@ -1,4 +1,4 @@ -// Lprs - A local CLI password manager +// Lprs - A local CLI vault manager // Copyright (C) 2024 Awiteb // // This program is free software: you can redistribute it and/or modify @@ -35,17 +35,17 @@ pub struct Remove { } impl RunCommand for Remove { - fn run(&self, mut password_manager: Vaults) -> LprsResult<()> { + fn run(&self, mut vault_manager: Vaults) -> LprsResult<()> { let index = (self.index.get() - 1) as usize; - if index > password_manager.vaults.len() { + if index > vault_manager.vaults.len() { if !self.force { return Err(LprsError::Other( "The index is greater than the passwords counts".to_owned(), )); } } else { - password_manager.vaults.remove(index); - password_manager.try_export()?; + vault_manager.vaults.remove(index); + vault_manager.try_export()?; } Ok(()) } diff --git a/src/errors.rs b/src/errors.rs index 50d44e6..52ac749 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -1,4 +1,4 @@ -// Lprs - A local CLI password manager +// Lprs - A local CLI vault manager // Copyright (C) 2024 Awiteb // // This program is free software: you can redistribute it and/or modify diff --git a/src/macros.rs b/src/macros.rs index f31d85a..454b8ed 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -1,4 +1,4 @@ -// Lprs - A local CLI password manager +// Lprs - A local CLI vault manager // Copyright (C) 2024 Awiteb // // This program is free software: you can redistribute it and/or modify @@ -43,8 +43,8 @@ /// vault_manager: crate::vault::Vaults, /// ) -> crate::LprsResult<()> { /// match self { -/// Self::Test(command) => command.run(password_manager), -/// Self::Some(command) => command.run(password_manager), +/// Self::Test(command) => command.run(vault_manager), +/// Self::Some(command) => command.run(vault_manager), /// } /// } /// } @@ -63,10 +63,10 @@ macro_rules! create_commands { #[automatically_derived] impl $crate::RunCommand for $enum_name{ - fn run(&self, password_manager: $crate::vault::Vaults<$crate::vault::vault_state::Plain>) -> $crate::LprsResult<()> { + fn run(&self, vault_manager: $crate::vault::Vaults<$crate::vault::vault_state::Plain>) -> $crate::LprsResult<()> { match self { $( - Self::$varint(command) => command.run(password_manager), + Self::$varint(command) => command.run(vault_manager), )+ } } diff --git a/src/main.rs b/src/main.rs index c3186cf..bfe7443 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -// Lprs - A local CLI password manager +// Lprs - A local CLI vault manager // Copyright (C) 2024 Awiteb // // This program is free software: you can redistribute it and/or modify diff --git a/src/traits.rs b/src/traits.rs index 5be273b..dd8e9c4 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -1,4 +1,4 @@ -// Lprs - A local CLI password manager +// Lprs - A local CLI vault manager // Copyright (C) 2024 Awiteb // // This program is free software: you can redistribute it and/or modify @@ -21,5 +21,5 @@ use crate::{ /// Trait to run the command pub trait RunCommand { - fn run(&self, password_manager: Vaults) -> LprsResult<()>; + fn run(&self, vault_manager: Vaults) -> LprsResult<()>; } diff --git a/src/utils.rs b/src/utils.rs index ef1dd7d..4e21c24 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,4 +1,4 @@ -// Lprs - A local CLI password manager +// Lprs - A local CLI vault manager // Copyright (C) 2024 Awiteb // // This program is free software: you can redistribute it and/or modify diff --git a/src/vault/cipher.rs b/src/vault/cipher.rs index 0b34b0b..8e66c71 100644 --- a/src/vault/cipher.rs +++ b/src/vault/cipher.rs @@ -1,4 +1,4 @@ -// Lprs - A local CLI password manager +// Lprs - A local CLI vault manager // Copyright (C) 2024 Awiteb // // This program is free software: you can redistribute it and/or modify diff --git a/src/vault/validator.rs b/src/vault/validator.rs index f27e37c..784a84b 100644 --- a/src/vault/validator.rs +++ b/src/vault/validator.rs @@ -1,4 +1,4 @@ -// Lprs - A local CLI password manager +// Lprs - A local CLI vault manager // Copyright (C) 2024 Awiteb // // This program is free software: you can redistribute it and/or modify