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
42
43
44
45
46
47
48
49
50
|
# File 'lib/pssh/cli.rb', line 15
def self.parse_options(args)
options = {}
@opts = OptionParser.new do |opts|
opts.banner = BANNER.gsub(/^ {4}/, '')
opts.separator ''
opts.separator 'Options:'
opts.on('--readonly', 'Only allow viewing the session, not writing.') do
options[:io_mode] = 'r'
end
opts.on('-p PORT', '--port PORT', Integer, 'Set the port that Pssh will run on') do |port|
options[:port] = port.to_i
end
opts.on('-c PATH', '--command COMMAND', [:tmux, :screen, :shell], 'Set the tool that will be used to initialize the web session (tmux, screen, or shell)') do |command|
options[:command] = command
end
opts.on('-s NAME', '--socket NAME', String, 'Set the socket that will be used for connecting (socket-name)') do |socket|
options[:socket_path] = socket
end
opts.on( '-h', '--help', 'Display this help.' ) do
puts opts
exit
end
end
@opts.parse!(args)
options
end
|