Class: Pair::CommandLine::Host
- Inherits:
-
Pair::CommandLine
- Object
- Pair::CommandLine
- Pair::CommandLine::Host
- Defined in:
- lib/pair/command_line/host.rb
Instance Attribute Summary
Attributes inherited from Pair::CommandLine
Instance Method Summary collapse
Methods inherited from Pair::CommandLine
Constructor Details
This class inherits a constructor from Pair::CommandLine
Instance Method Details
#parse! ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/pair/command_line/host.rb', line 11 def parse! opts = parse do |opts| opts. = "Usage: #{$0} host [-s SESSION_NAME] [-v PAIR[,PAIR[,...]] [-p PAIR[,PAIR[,...]]" + "\n\n" + "At least one PAIR (of any type must be defined). A PAIR takes the form of a Github username." + "\n\n"+ "Options:" opts.on("-s", "--session-name=SESSION_NAME", "Automatically generated by server if not provided.") do |session_name| [:name] = session_name end opts.on("-v", "--viewers=PAIRS", Array) do |pairs| [:viewers] = pairs end opts.on("-p", "--participants=PAIRS", Array) do |pairs| [:participants] = pairs end opts.on_tail("-h", "--help", "Display this text") do puts opts exit end end if [:viewers].to_a.empty? && [:participants].to_a.empty? $stderr.puts "ERROR: At least one PAIR is required...\n\n" abort(opts.inspect) end end |