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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/mono/tool.rb', line 5
def self.main( args=ARGV )
options = {}
OptionParser.new do |parser|
parser.on( '-r NAME', '--require NAME') do |name|
options[:requires] ||= []
options[:requires] << name
end
end.parse!( args )
if options[:requires] options[:requires].each do |path|
puts "[monofile] auto-require >#{path}<..."
require( path )
end
else config_path = "./config.rb"
if File.exist?( config_path )
puts "[monofile] auto-require (default) >#{config_path}<..."
require( config_path )
end
end
cmd = if args.size == 0
'status' else
args.shift end
case cmd.downcase
when 'status', 'stati', 'stat', 'st', 's'
Mono.status
when 'sync', 'syn', 'sy', 'get', 'g',
'install', 'insta', 'inst', 'ins', 'i',
'up', 'u'
Mono.sync
when 'fetch', 'f'
Mono.fetch
when 'env', 'e'
Mono.env
when 'backup', 'back', 'b'
Mono.backup
when 'run', 'r', 'exec'
Mono.run( args )
when 'walk'
Mono.walk
else
puts "!! ERROR: unknown command >#{cmd}<"
exit 1
end
end
|