From e323935ae8bd89560c0cdc6d6e6f873b0072650a Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 19 Apr 2020 05:42:22 -0400 Subject: allow getting notes along with a password --- src/bin/rbw/commands.rs | 8 +++++++- src/bin/rbw/main.rs | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src/bin/rbw') diff --git a/src/bin/rbw/commands.rs b/src/bin/rbw/commands.rs index 75ab8e3..839dca3 100644 --- a/src/bin/rbw/commands.rs +++ b/src/bin/rbw/commands.rs @@ -98,7 +98,7 @@ pub fn list() -> anyhow::Result<()> { Ok(()) } -pub fn get(name: &str, user: Option<&str>) -> anyhow::Result<()> { +pub fn get(name: &str, user: Option<&str>, full: bool) -> anyhow::Result<()> { unlock()?; let email = config_email()?; @@ -120,6 +120,12 @@ pub fn get(name: &str, user: Option<&str>) -> anyhow::Result<()> { eprintln!("entry for '{}' had no password", desc); } + if full { + if let Some(notes) = decrypted.notes { + println!("\n{}", notes); + } + } + Ok(()) } diff --git a/src/bin/rbw/main.rs b/src/bin/rbw/main.rs index 90ef95e..31f7fd0 100644 --- a/src/bin/rbw/main.rs +++ b/src/bin/rbw/main.rs @@ -30,7 +30,8 @@ fn main() { .subcommand( clap::SubCommand::with_name("get") .arg(clap::Arg::with_name("name").required(true)) - .arg(clap::Arg::with_name("user")), + .arg(clap::Arg::with_name("user")) + .arg(clap::Arg::with_name("full").long("full")), ) .subcommand( clap::SubCommand::with_name("add") @@ -103,6 +104,7 @@ fn main() { ("get", Some(smatches)) => commands::get( smatches.value_of("name").unwrap(), smatches.value_of("user"), + smatches.is_present("full"), ) .context("get"), // this unwrap is safe because name is marked .required(true) -- cgit v1.2.3-54-g00ecf