We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4d74db8 commit 8ed354fCopy full SHA for 8ed354f
src/arguments/delete.rs
@@ -1,4 +1,4 @@
1
-use std::io::{self};
+use std::io::{self, Write};
2
3
use clap::Args;
4
use color_eyre::eyre::eyre;
@@ -33,14 +33,17 @@ impl SubcommandExecutor for DeleteArgs {
33
let mut output = String::with_capacity(1);
34
35
let element = otp_database.elements_ref().get(index_to_delete).unwrap();
36
- println!(
+ print!(
37
"Are you sure you want to delete the {}th code ({}, {}) [Y,N]: ",
38
- index_to_delete, element.issuer, element.label
+ index_to_delete + 1,
39
+ element.issuer,
40
+ element.label
41
);
42
+ io::stdout().flush()?;
43
44
io::stdin().read_line(&mut output)?;
45
- if output.eq_ignore_ascii_case("y") {
46
+ if output.trim().eq_ignore_ascii_case("y") {
47
otp_database.delete_element(index_to_delete);
48
Ok(otp_database)
49
} else {
0 commit comments