From a8a083250b2d0fa00e4b6635249738373b0d215e Mon Sep 17 00:00:00 2001 From: Adrien Waksberg Date: Mon, 26 Sep 2016 21:56:00 +0200 Subject: [PATCH] quit if delete item --- lib/mpw/cli.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/mpw/cli.rb b/lib/mpw/cli.rb index 337b95e..cb061c7 100644 --- a/lib/mpw/cli.rb +++ b/lib/mpw/cli.rb @@ -260,7 +260,7 @@ class Cli puts I18n.t('form.clipboard.otp', time: @mpw.get_otp_remaining_time).yellow when 'd', 'delete' - delete(item) + break if delete(item) when 'u', 'update', 'e', 'edit' update(item) @@ -270,6 +270,8 @@ class Cli puts I18n.t('form.clipboard.help.login') puts I18n.t('form.clipboard.help.password') puts I18n.t('form.clipboard.help.otp_code') + puts I18n.t('form.clipboard.help.update') + puts I18n.t('form.clipboard.help.delete') next end end @@ -405,7 +407,7 @@ class Cli confirm = ask("#{I18n.t('form.delete_item.ask')} (y/N) ").to_s if not confirm =~ /^(y|yes|YES|Yes|Y)$/ - return + return false end item.delete @@ -413,8 +415,11 @@ class Cli @mpw.sync(true) if @sync puts "#{I18n.t('form.delete_item.valid')}".green + + return true rescue Exception => e puts "#{I18n.t('display.error')} #16: #{e}".red + return false end # Export the items in a CSV file