|
jim_brower (on ) commented
11 years ago
I know there will be issues with the command line arguments since I didn't use an awesome gem to do them. Putting an invalid argument will cause it to give an ugly error, and you could potentially put duplicate arguments where the last one would be the one that's used. |
Reply ·0 | |
|
|
|
+#!/usr/bin/env ruby +# +# Triggers: +# ForceRmdir form-in client "ForceRmdir.rb %formfile%"
Matt Attaway (on ForceClientOptions.rb, line 4) commented
11 years ago
Make sure to update your usage. |
Reply ·0 | |
|
|
|
+ +form.each do |line| + if /^Client:.*p4sandbox-.*$/ =~ line + form.close + exit 0
Matt Attaway (on ForceClientOptions.rb, line 45) commented
11 years ago
You can pull out the close statement; exiting will handle that. |
Reply ·0 | |
|
|
|
+ if /.*modtime/ =~ option + opts[4] = option + end + if /.*rmdir/ =~ option + opts[5] = option
Matt Attaway (on ForceClientOptions.rb, line 33) commented
11 years ago
Ifs are totally functional here, but a case statement is probably a bit more legible. They even accept reflexes in Ruby. |
Reply ·0 | |
|
|
|
Matt Attaway (on ) commented
11 years ago
The approach you chose is solid. For the sake of robustness, let's add a requirement that a new option could be added and the script needs to leave that new option unchanged. Let's assume that the new option is not guaranteed to be at the end of the list of options. This change should effectively make the script completely future proof. |
Reply ·0 | |
|