replace opts by value for options to search

This commit is contained in:
Adrien Waksberg 2016-10-23 22:10:58 +02:00
parent 6d2a45217c
commit f1f92d5658
5 changed files with 17 additions and 29 deletions

View file

@ -25,6 +25,7 @@ require 'mpw/cli'
# --------------------------------------------------------- #
options = {}
values = {}
OptionParser.new do |opts|
opts.banner = "#{I18n.t('option.usage')}: mpw list [options]"
@ -34,7 +35,7 @@ OptionParser.new do |opts|
end
opts.on('-g', '--group NAME', I18n.t('option.group')) do |group|
options[:group] = group
values[:group] = group
end
opts.on('-h', '--help', I18n.t('option.help')) do
@ -43,7 +44,7 @@ OptionParser.new do |opts|
end
opts.on('-p', '--pattern PATTERN', I18n.t('option.pattern')) do |pattern|
options[:pattern] = pattern
values[:pattern] = pattern
end
opts.on('-w', '--wallet NAME', I18n.t('option.wallet')) do |wallet|
@ -54,11 +55,7 @@ end.parse!
config = MPW::Config.new(options[:config])
cli = MPW::Cli.new(config, options[:sync])
opts = { search: options[:pattern],
group: options[:group],
}
cli.load_config
cli.get_wallet(options[:wallet])
cli.decrypt
cli.list(opts)
cli.list(values)