mirror of
https://github.com/nishiki/manage-password.git
synced 2025-02-21 10:20:05 +00:00
fix bug in mpw-ssh since add sync
This commit is contained in:
parent
2199e8cf8a
commit
352bc24f1a
2 changed files with 17 additions and 7 deletions
|
@ -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
22
mpw-ssh
|
@ -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
|
||||||
|
|
Loading…
Add table
Reference in a new issue