19 [ '--help', '-h', GetoptLong::NO_ARGUMENT ], |
19 [ '--help', '-h', GetoptLong::NO_ARGUMENT ], |
20 [ '--update', '-u', GetoptLong::NO_ARGUMENT ], |
20 [ '--update', '-u', GetoptLong::NO_ARGUMENT ], |
21 [ '--setup', '-s', GetoptLong::NO_ARGUMENT ], |
21 [ '--setup', '-s', GetoptLong::NO_ARGUMENT ], |
22 ); |
22 ); |
23 |
23 |
24 case opts.get.shift |
24 Dir.chdir( |
25 when '--help' |
25 File.dirname File.expand_path $0 |
26 puts <<-ENDHELP.sub(/^\s+/,'') |
26 ) |
27 #{$0} usage: |
27 |
28 -h --help This help message |
28 opts.each do |opt, arg| |
29 -s --setup Perform home directory setup (git clone) |
29 case opt |
30 -u --update Update git stuff (git pull) |
30 when '--help' |
31 ENDHELP |
31 puts <<-ENDHELP.sub(/^\s+/,'') |
32 exit 1 |
32 #{$0} usage: |
33 when '--setup' |
33 -h --help This help message |
34 setup |
34 -s --setup Perform home directory setup (git clone) |
35 when '--update' |
35 -u --update Update git stuff (git pull) |
36 update |
36 ENDHELP |
|
37 exit 1 |
|
38 when '--setup' |
|
39 setup |
|
40 when '--update' |
|
41 update |
|
42 end |
37 end |
43 end |
38 end |
44 end |
39 |
45 |
40 # just checks and bails after each call, output already in STDERR |
46 # just checks and bails after each call, output already in STDERR |
41 def do_cmds (*cmds) |
47 def do_cmds (*cmds) |