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

Loading…
Cancel
Save