5
6
7
8
9
10
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
42
43
44
|
# File 'lib/rest_shifter/commands/main.rb', line 5
def run(args=ARGV)
cmd = args.shift
case cmd
when "-s", "--start", "start"
port = args.shift
port = "8080" unless !port.to_s.empty?
RestShifter::Commands::Start.run port
exit 0
when "-X", "--start-secure-no-cert", "start-secure-no-cert"
port = args.shift
port = "4443" unless !port.to_s.empty?
RestShifter::Commands::Start.run_secure_no_cert port
exit 0
when "-S", "--start-secure", "start-secure"
port = args.shift
cert = args.shift
key = args.shift
port = "4443" unless !port.to_s.empty?
RestShifter::Commands::Start.run_secure port, cert, key
exit 0
when "-c", "--create", "create"
RestShifter::Commands::Create.run
exit 0
when "-h", "--help", NilClass
RestShifter::Commands::Help.run
exit 0
when "-v", "--version", "version"
RestShifter::Commands::Version.run
exit 0
end
unless system("restshifter #{cmd}", *args)
if $?.exitstatus == 127 puts "Unknown subcommand #{cmd.inspect}"
RestShifter::Commands::Help.run
exit 127
end
end
end
|