aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/rbw/commands.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2020-04-19 05:33:19 -0400
committerJesse Luehrs <doy@tozt.net>2020-04-19 05:33:19 -0400
commit32db6b408b9a3070795f7a29ba5c429471fb056b (patch)
tree9c6bdc75d5b016297d87b0ff4ab510e39e9193b6 /src/bin/rbw/commands.rs
parenta65c972116daa16efc6b4d7d355fcec9b342dd28 (diff)
downloadrbw-32db6b408b9a3070795f7a29ba5c429471fb056b.tar.gz
rbw-32db6b408b9a3070795f7a29ba5c429471fb056b.zip
sort the rbw list output
Diffstat (limited to 'src/bin/rbw/commands.rs')
-rw-r--r--src/bin/rbw/commands.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/bin/rbw/commands.rs b/src/bin/rbw/commands.rs
index 81ea2e2..75ab8e3 100644
--- a/src/bin/rbw/commands.rs
+++ b/src/bin/rbw/commands.rs
@@ -82,12 +82,17 @@ pub fn list() -> anyhow::Result<()> {
let email = config_email()?;
let db = rbw::db::Db::load(&email)
.context("failed to load password database")?;
- for entry in db.entries {
- println!(
- "{}",
- crate::actions::decrypt(&entry.name)
- .context("failed to decrypt entry name")?
- );
+
+ let mut ciphers: Vec<DecryptedCipher> = db
+ .entries
+ .iter()
+ .cloned()
+ .map(|entry| decrypt_cipher(&entry))
+ .collect::<anyhow::Result<_>>()?;
+ ciphers.sort_unstable_by(|a, b| a.name.cmp(&b.name));
+
+ for cipher in ciphers {
+ println!("{}", cipher.name);
}
Ok(())