Skip to content

Commit

Permalink
feat: first draft implementation of List subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
replydev committed May 7, 2024
1 parent 7c6429e commit 432f428
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/arguments/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,24 @@ impl Default for ListFormat {

impl SubcommandExecutor for ListArgs {
fn run_command(self, otp_database: OTPDatabase) -> color_eyre::Result<OTPDatabase> {
todo!()
otp_database
.elements
.iter()
.enumerate()
.for_each(|(index, e)| {
println!(
"{}\t{}\t{}\t{}",
index,
if e.issuer.is_empty() {
"<No issuer>"
} else {
e.issuer.as_str()
},
&e.label,
e.get_otp_code()
.unwrap_or("ERROR during calculation".to_string())
)
});
Ok(otp_database)
}
}

0 comments on commit 432f428

Please sign in to comment.