From c98ff1c91470d21600827e5f70fcf5c32c85922a Mon Sep 17 00:00:00 2001 From: Carson McManus Date: Sat, 14 Aug 2021 23:45:17 -0400 Subject: [PATCH] allow load_accounts to take encryption passkey --- src/accountmanager.rs | 6 +++--- src/main.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/accountmanager.rs b/src/accountmanager.rs index 6c09897..11fb010 100644 --- a/src/accountmanager.rs +++ b/src/accountmanager.rs @@ -84,7 +84,7 @@ impl Manifest { return Ok(manifest); } - pub fn load_accounts(&mut self) -> anyhow::Result<()> { + pub fn load_accounts(&mut self, passkey: Option<&str>) -> anyhow::Result<()> { for entry in &mut self.entries { let path = Path::new(&self.folder).join(&entry.filename); debug!("loading account: {:?}", path); @@ -187,7 +187,7 @@ mod tests { let mut loaded_manifest = Manifest::load(manifest_path.as_path()).unwrap(); assert_eq!(loaded_manifest.entries.len(), 1); assert_eq!(loaded_manifest.entries[0].filename, "asdf1234.maFile"); - assert!(matches!(loaded_manifest.load_accounts(), Ok(_))); + assert!(matches!(loaded_manifest.load_accounts(None), Ok(_))); assert_eq!( loaded_manifest.entries.len(), loaded_manifest.accounts.len() @@ -257,7 +257,7 @@ mod tests { assert!(matches!(result, Ok(_))); let mut manifest = result.unwrap(); assert!(matches!(manifest.entries.last().unwrap().encryption, None)); - assert!(matches!(manifest.load_accounts(), Ok(_))); + assert!(matches!(manifest.load_accounts(None), Ok(_))); assert_eq!( manifest.entries.last().unwrap().account_name, manifest diff --git a/src/main.rs b/src/main.rs index 2b57a60..3799275 100644 --- a/src/main.rs +++ b/src/main.rs @@ -173,7 +173,7 @@ fn main() { } manifest - .load_accounts() + .load_accounts(matches.value_of("passkey")) .expect("Failed to load accounts in manifest"); if matches.is_present("setup") {