lib/t2-server-cli.rb in t2-server-1.1.0 vs lib/t2-server-cli.rb in t2-server-1.2.0

- old
+ new

@@ -51,27 +51,22 @@ # SSL options ssl_auth_opts(opt, conn_params) ssl_transport_opts(opt, conn_params) - # common options + # Simple credential options opt.on_tail("-u", "--username=USERNAME", "The username to use for " + "server operations.") do |val| user = val.chomp end opt.on_tail("-p", "--password=PASSWORD", "The password to use for " + "the supplied username.") do |val| pass = val.chomp end - opt.on_tail("-h", "-?", "--help", "Show this help message.") do - puts opt - exit - end - opt.on_tail("-v", "--version", "Show the version.") do - puts "Taverna 2 Server Ruby Gem version: #{T2Server::Version::STRING}" - exit - end + + # Common options + common_opts(opt) end # parse options @opts.parse! @@ -93,9 +88,21 @@ def opts @opts end private + + # The help and version options. + def common_opts(opt) + opt.on_tail("-h", "-?", "--help", "Show this help message.") do + puts opt + exit + end + opt.on_tail("-v", "--version", "Show the version.") do + puts "Taverna 2 Server Ruby Gem version: #{T2Server::Version::STRING}" + exit + end + end # The SSL authentication and peer verification options. def ssl_auth_opts(opt, conn_params) opt.on("-E CERT_FILE:PASSWORD", "--cert=CERT_FILE:PASSWORD", "Use " + "the specified certificate file for client authentication. If the " +