1
0
Fork 0
mirror of https://github.com/nishiki/manage-password.git synced 2024-10-27 10:43:20 +00:00

fix bug in mpw-ssh since add sync

This commit is contained in:
nishiki 2014-01-23 22:32:48 +01:00
parent 2199e8cf8a
commit 352bc24f1a
2 changed files with 17 additions and 7 deletions

View file

@ -12,7 +12,7 @@ class CliSSH < Cli
# Connect to SSH # Connect to SSH
# args: search -> string to search # args: search -> string to search
def ssh(search) def ssh(search)
result = @m.search(search, nil, 'ssh') result = @mpw.search(search, nil, 'ssh')
if result.length > 0 if result.length > 0
result.each do |r| result.each do |r|

22
mpw-ssh
View file

@ -39,20 +39,30 @@ OptionParser.new do |opts|
options[:config] = config options[:config] = config
end end
opts.on("-h", "--help", I18n.t('ssh.option.help')) do |b| opts.on("-h", "--help", I18n.t('ssh.option.help')) do
puts opts puts opts
exit 0 exit 0
end end
end.parse! end.parse!
cli = CliSSH.new(lang, options[:config]) config = MPWConfig.new(options[:config])
cli.login = options[:login] check_error = config.checkconfig()
cli.server = options[:server]
cli.port = options[:port] cli = CliSSH.new(lang, config)
cli.login = options[:login]
cli.server = options[:server]
cli.port = options[:port]
search = ARGV[0] search = ARGV[0]
if ARGV.length < 1 cli.sync()
# Setup a new config
if !check_error
cli.setup(lang)
# Connect ssh
elsif ARGV.length < 1
puts "#{I18n.t('ssh.option.usage')}: mpw-ssh SEARCH [options]" puts "#{I18n.t('ssh.option.usage')}: mpw-ssh SEARCH [options]"
exit 2 exit 2
end end