Browse Source

edit on add existing

fix-typo
Coin de Gamma 3 months ago
parent
commit
3d4d657f87
  1. 14
      src/main.rs

14
src/main.rs

@ -119,12 +119,14 @@ fn add(id: &String) -> io::Result<()> {
let passphrase = login()?;
let mut st = Storage::from_db(passphrase)?;
if st.contains(id) {
// TODO: ask to edit existing in outer function which invoked this one
return Err(io::Error::new(
io::ErrorKind::InvalidInput,
format!("Dublicate item id: {}. Item id's must be unique.", id)
// TODO: ask to edit [Y/n]
))
let question = format!("Item [{}] exist. Do you want to edit it instead?", id);
match get_prompt(&question)? {
PROMPT::YES => {
edit(id)?;
return Ok(());
},
PROMPT::NO => return Ok(()),
}
}
let content = editor::open_to_edit()?;

Loading…
Cancel
Save