diff --git a/cli.rb b/cli.rb index af7b98d..6c39df7 100755 --- a/cli.rb +++ b/cli.rb @@ -111,15 +111,25 @@ class Cli end end - def remove(id) - if @m.remove(id) - if @m.encrypt() - puts "The item #{id} has been removed!" - else - puts "ERROR: #{@m.error_msg}" + def remove(id, force=false) + + if not force + confirm = ask("Are you sur to remove the item: #{id} ? (y/N) ") + if confirm =~ /^(y|yes|YES|Yes|Y)$/ + force = true + end + end + + if force + if @m.remove(id) + if @m.encrypt() + puts "The item #{id} has been removed!" + else + puts "ERROR: #{@m.error_msg}" + end + else + puts "Nothing item has been removed!" end - else - puts "Nothing item has been removed!" end end diff --git a/mpw b/mpw index 271127f..374a7e8 100755 --- a/mpw +++ b/mpw @@ -52,7 +52,6 @@ end.parse! cli = Cli.new() -puts options # Display the item's informations if not options[:display].nil? if not options[:type].nil? @@ -65,7 +64,11 @@ if not options[:display].nil? # Remove an item elsif not options[:remove].nil? - cli.remove(options[:remove]) + if not options[:force].nil? + cli.remove(options[:remove], options[:force]) + else + cli.remove(options[:remove]) + end # Update an item elsif not options[:update].nil?