lib/con_ssh.rb in con_ssh-0.0.4 vs lib/con_ssh.rb in con_ssh-0.0.5
- old
+ new
@@ -20,30 +20,35 @@
# knock / unknock
elsif ['knock', 'unknock'].include? args[1]
ign_arg_warn args, 2
parse_conf
conn_conf = @conn_confs[args[0]]
- unless conn_confs
+ unless conn_conf
warn "Shorcut #{args[0]} not found. See #{CONF_PATH}."
exit 1
end
ports = conn_conf[args[1]]
if ports.nil? || ports.empty?
warn "#{conn_conf.conn_desc} has no #{args[1]} configuration."
exit 1
end
knock conn_conf.host, ports
- # connect
- elsif conn_conf = @conn_confs[args[0]]
- ign_arg_warn args, 1
- parse_conf
- ssh conn_conf
-
# help
elsif ['-h'].include? args[0]
ign_arg_warn args, 1
print_help
+
+ # connect
+ elsif args[0]
+ ign_arg_warn args, 1
+ parse_conf
+ conn_conf = @conn_confs[args[0]]
+ unless conn_conf
+ warn "Shorcut #{args[0]} not found. See #{CONF_PATH}."
+ exit 1
+ end
+ ssh conn_conf
# fail
else
warn "Invalid arguments."
print_help