lib/rjobs/cli_helper.rb in rjobs-0.2.0.alpha vs lib/rjobs/cli_helper.rb in rjobs-0.3.0.alpha

- old
+ new

@@ -1,5 +1,7 @@ +require "trollop" + module Rjobs module CliHelper def get_jobs_info(jobs_file) jf = JobsFile.new(jobs_file) jobs= [] @@ -8,7 +10,22 @@ job.name = jf.job_names[index] jobs << job end jobs end + + def parser(banner_string) + default_hostname = ENV['XGRID_CONTROLLER_HOSTNAME'].nil? ? "127.0.0.1" : ENV['XGRID_CONTROLLER_HOSTNAME'] + default_password = ENV['XGRID_CONTROLLER_PASSWORD'].nil? ? "xgrid" : ENV['XGRID_CONTROLLER_PASSWORD'] + Trollop::Parser.new do + banner banner_string + opt :host, "Hostname or IP address of the xgrid controller", + :type=> String, + :default=> default_hostname + opt :password, "Password to access the xgrid controller", + :type=> String, + :default=> default_password + end + end + end end