Skip to content

Commit 8ed354f

Browse files
committed
fix: parse user import correctly in delete subcommand
1 parent 4d74db8 commit 8ed354f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/arguments/delete.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::io::{self};
1+
use std::io::{self, Write};
22

33
use clap::Args;
44
use color_eyre::eyre::eyre;
@@ -33,14 +33,17 @@ impl SubcommandExecutor for DeleteArgs {
3333
let mut output = String::with_capacity(1);
3434

3535
let element = otp_database.elements_ref().get(index_to_delete).unwrap();
36-
println!(
36+
print!(
3737
"Are you sure you want to delete the {}th code ({}, {}) [Y,N]: ",
38-
index_to_delete, element.issuer, element.label
38+
index_to_delete + 1,
39+
element.issuer,
40+
element.label
3941
);
42+
io::stdout().flush()?;
4043

4144
io::stdin().read_line(&mut output)?;
4245

43-
if output.eq_ignore_ascii_case("y") {
46+
if output.trim().eq_ignore_ascii_case("y") {
4447
otp_database.delete_element(index_to_delete);
4548
Ok(otp_database)
4649
} else {

0 commit comments

Comments
 (0)