26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/pair/cli/host.rb', line 26
def parse!
opts = parse do |opts|
opts.banner = "Usage: #{$0.split("/").last} 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|
options[:name] = session_name
end
opts.on("-v", "--viewers=PAIRS", Array) do |pairs|
options[:viewers] = pairs
end
opts.on("-p", "--participants=PAIRS", Array) do |pairs|
options[:participants] = pairs
end
opts.on_tail("-h", "--help", "Display this text") do
puts opts
exit
end
end
if options[:viewers].to_a.empty? && options[:participants].to_a.empty?
$stderr.puts "ERROR: At least one PAIR is required...\n\n"
abort(opts.inspect)
end
end
|