lib/con_ssh.rb in con_ssh-0.0.1 vs lib/con_ssh.rb in con_ssh-0.0.2

- old
+ new

@@ -12,16 +12,16 @@ end def run *args # setup if args[0] == 'setup' - warn "Ignoring arguments after #{args[0]}." if args.length > 1 + ign_arg_warn args, 1 install_sample_conf # knock / unknock elsif ['knock', 'unknock'].include? args[1] - warn "Ignoring arguments after #{args[1]}." if args.length > 2 + ign_arg_warn args, 2 parse_conf conn_conf = @conn_confs[args[0]] unless conn_confs warn "Shorcut #{args[0]} not found. See #{CONF_PATH}." exit 1 @@ -33,17 +33,17 @@ end knock conn_conf.host, ports # connect elsif conn_conf = @conn_confs[args[0]] - warn "Ignoring arguments after #{args[0]}." if args.length > 1 + ign_arg_warn args, 1 parse_conf ssh conn_conf # help elsif ['-h'].include? args[0] - warn "Ignoring arguments after #{args[0]}." if args.length > 1 + ign_arg_warn args, 1 print_help # fail else warn "Invalid arguments." @@ -143,9 +143,13 @@ end # Util + def ign_arg_warn args, max + warn "Ignoring arguments after #{args[0]}." if args.length > max + end + def warn desc $stderr.puts desc end def skip_line? line