Skip to content

Commit 1c921ef

Browse files
authored
fix: do not throw error on empty otp database, in list subcommand (#568)
2 parents 1318571 + 0222faf commit 1c921ef

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/arguments/list.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ impl SubcommandExecutor for ListArgs {
7171
.map_err(|e| eyre!("Error during JSON serialization: {:?}", e))?;
7272
print!("{stringified}");
7373
} else {
74+
if otp_database.elements.is_empty() {
75+
println!("No elements to list");
76+
return Ok(otp_database);
77+
}
7478
let issuer_width = calculate_width(&otp_database, |element| {
7579
let issuer_length = element.issuer.chars().count();
7680
if issuer_length > 0 {

0 commit comments

Comments
 (0)