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

fix mpw-ssh

This commit is contained in:
nishiki 2015-06-23 22:10:08 +02:00
parent 7d71dded68
commit eb0847b16b
4 changed files with 12 additions and 8 deletions

View file

@ -11,4 +11,8 @@ This program work with ruby >= 1.9
* install ruby and rubygems on your computer * install ruby and rubygems on your computer
* gem install mpw * gem install mpw
If you want use mpw-ssh, you must install sshpass
# How to use
mpw -h

View file

@ -1 +1 @@
2.0.0 2.0.1

View file

@ -12,15 +12,15 @@ 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 = @mpw.search(search, nil, 'ssh') result = @mpw.list(search: search, protocol: 'ssh')
if result.length > 0 if result.length > 0
result.each do |r| result.each do |item|
server = @server.nil? ? r[:host] : @server server = @server.nil? ? item.host : @server
port = @port.nil? ? r[:port] : @port port = @port.nil? ? item.port : @port
login = @login.nil? ? r[:login] : @login login = @login.nil? ? item.user : @login
passwd = r[:password] passwd = item.password
if port.nil? and port.empty? if port.nil? and port.empty?
port = 22 port = 22

View file

@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
spec.license = 'GPL' spec.license = 'GPL'
spec.files = `git ls-files -z`.split("\x0") spec.files = `git ls-files -z`.split("\x0")
spec.executables = ['mpw', 'mpw-server'] spec.executables = ['mpw', 'mpw-server', 'mpw-ssh']
spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib'] spec.require_paths = ['lib']
end end