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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/ruby_config/options_parser.rb', line 12
def create_options
@options = OpenStruct.new
@options.verbose = false
@options.list_available = false
@options.list_installed = false
@options.use = false
@options.runtime = nil
@options.install = false
@options.uninstall = false
@options.help = false
@options.setup = false
@optparse = OptionParser.new do |opts|
opts.banner = "Usage: ruby-config [options]"
opts.on('-a', '--list-available', 'List available Ruby runtimes') do
@options.list_available = true
end
opts.on('-l', '--list-installed', 'List installed Ruby runtimes') do
@options.list_installed = true
end
opts.on('-u', '--use [HANDLE]', 'Use specific Ruby runtime') do |runtime|
@options.use = true
@options.runtime = runtime
abort("No Runtime specified") unless runtime
end
opts.on('-i', '--install [HANDLE]', 'Install specific Ruby runtime') do |runtime|
@options.install = true
@options.runtime = runtime
abort("No Runtime specified") unless runtime
end
opts.on('--uninstall [HANDLE]', 'Uninstall specific Ruby runtime') do |runtime|
@options.uninstall = true
@options.runtime = runtime
abort("No Runtime specified") unless runtime
end
opts.on('--setup', 'Setup your bash script') do
@options.setup = true
end
opts.on('-v', '--version', 'Display version' ) do
puts "ruby-config version: #{RubyConfig.version}"
exit
end
opts.on('-h', '--help', 'Display this screen' ) do
@options.help = true
end
end
end
|