Skip to content

Commit

Permalink
fixed option parser to parse passed args instead of global ARGV
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Lewis committed Nov 29, 2009
1 parent bc3702c commit 54285b6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/scout.rb
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby -wKU #!/usr/bin/env ruby -wKU


module Scout module Scout
VERSION = "4.0.2".freeze VERSION = "5.0.0".freeze
end end


require "scout/command" require "scout/command"
Expand Down
18 changes: 8 additions & 10 deletions lib/scout/command.rb
Expand Up @@ -25,7 +25,7 @@ def self.usage
def self.parse_options(argv) def self.parse_options(argv)
options = { } options = { }


ARGV.options do |opts| op = OptionParser.new do |opts|
opts.banner = "Usage:" opts.banner = "Usage:"


opts.separator " Normal checkin with server:" opts.separator " Normal checkin with server:"
Expand Down Expand Up @@ -99,16 +99,15 @@ def self.parse_options(argv)
opts.on( "-F", "--force", "Force checkin to Scout server regardless of last checkin time") do |bool| opts.on( "-F", "--force", "Force checkin to Scout server regardless of last checkin time") do |bool|
options[:force] = bool options[:force] = bool
end end

begin
opts.parse!
@usage = opts.to_s
rescue
puts opts
exit
end
end end


begin
op.parse!(argv)
@usage = op.to_s
rescue
puts op
exit
end
options options
end end
private_class_method :parse_options private_class_method :parse_options
Expand All @@ -124,7 +123,6 @@ def self.dispatch(argv)
else else
Install.new(options, argv) Install.new(options, argv)
end end

command.run command.run
end end


Expand Down

0 comments on commit 54285b6

Please sign in to comment.