1
0
Fork 0
mirror of https://github.com/nishiki/manage-password.git synced 2024-11-23 22:03:05 +00:00

add options id

This commit is contained in:
nishiki 2016-05-07 13:03:23 +02:00
parent 2d35e19fd0
commit 27c4162aa9

22
bin/mpw
View file

@ -58,8 +58,8 @@ OptionParser.new do |opts|
options[:config] = config options[:config] = config
end end
opts.on('-d', '--delete ID', I18n.t('option.remove')) do |id| opts.on('-d', '--delete', I18n.t('option.remove')) do
options[:delete] = id options[:delete] = true
end end
opts.on('-e', '--export FILE', I18n.t('option.export')) do |file| opts.on('-e', '--export FILE', I18n.t('option.export')) do |file|
@ -84,7 +84,11 @@ OptionParser.new do |opts|
exit 0 exit 0
end end
opts.on('-i', '--import FILE', I18n.t('option.import')) do |file| opts.on('-i', '--id ID', I18n.t('option.id')) do |id|
options[:id] = id
end
opts.on('-I', '--import FILE', I18n.t('option.import')) do |file|
options[:import] = file options[:import] = file
end end
@ -100,8 +104,8 @@ OptionParser.new do |opts|
options[:setup] = true options[:setup] = true
end end
opts.on('-u', '--update ID', I18n.t('option.update')) do |id| opts.on('-u', '--update', I18n.t('option.update')) do
options[:update] = id options[:update] = true
end end
opts.on('-w', '--wallet WALLET', I18n.t('option.wallet')) do |wallet| opts.on('-w', '--wallet WALLET', I18n.t('option.wallet')) do |wallet|
@ -138,12 +142,12 @@ if not options[:show].nil?
cli.display(opts) cli.display(opts)
# Remove an item # Remove an item
elsif not options[:delete].nil? elsif not options[:delete].nil? and not options[:id].nil?
cli.delete(options[:delete], options[:force]) cli.delete(options[:id], options[:force])
# Update an item # Update an item
elsif not options[:update].nil? elsif not options[:update].nil? and not options[:id].nil?
cli.update(options[:update]) cli.update(options[:id])
# Add a new item # Add a new item
elsif not options[:add].nil? elsif not options[:add].nil?