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
51
52
53
54
55
56
57
58
59
|
# File 'lib/uac_sh.rb', line 15
def self.parse_meta_args options, args
option_parser = OptionParser.new do |opt|
opt.banner = <<-EOF
Usage: uac <OPTIONS> <COMMAND>
For examples please see https://github.com/winteryoung/uac
EOF
opt.separator ""
opt.separator "Options:"
terminal_help = 'The given command will be executed in a terminal window, so cmd /c is added implictly. This is enabled by default.'
opt.on('-t', '--[no-]terminal', terminal_help) do |o|
options[:terminal] = o
if not o
options[:pause] = o
options[:cd] = o
end
end
pause_help = 'Pause after execution. This implies executing command line, so cmd.exe is the program to be executed. This option implies --terminal. This is enabled by default.'
opt.on('-p', '--[no-]pause', pause_help) do |o|
options[:pause] = o
if o
options[:terminal] = o
end
end
opt.on('--debug') do |o|
options[:debug] = o
end
opt.on('--cd', '-c', 'Change to current directory. Default is true. This option implies --terminal.') do |o|
options[:cd] = o
if o
options[:terminal] = o
end
end
opt.on_tail('-h', '--help', 'Print this help.') do |o|
puts opt
exit
end
end.parse! args
end
|