mirror of
https://github.com/nishiki/manage-password.git
synced 2025-02-20 01:50:04 +00:00
replace opts by value for options to search
This commit is contained in:
parent
f1f92d5658
commit
90e8b658bf
1 changed files with 8 additions and 7 deletions
15
bin/mpw-copy
15
bin/mpw-copy
|
@ -26,6 +26,7 @@ require 'mpw/cli'
|
|||
|
||||
options = {}
|
||||
options[:clipboard] = true
|
||||
values = {}
|
||||
|
||||
OptionParser.new do |opts|
|
||||
opts.banner = "#{I18n.t('option.usage')}: mpw copy [options]"
|
||||
|
@ -39,7 +40,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
|
||||
|
@ -47,8 +48,12 @@ OptionParser.new do |opts|
|
|||
exit 0
|
||||
end
|
||||
|
||||
opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
|
||||
options[:sync] = false
|
||||
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|
|
||||
|
@ -59,11 +64,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.copy(options[:clipboard], opts)
|
||||
cli.copy(options[:clipboard], values)
|
||||
|
|
Loading…
Add table
Reference in a new issue