lib/reviewer/arguments.rb in reviewer-0.1.4 vs lib/reviewer/arguments.rb in reviewer-0.1.5
- old
+ new
@@ -21,26 +21,33 @@
class Arguments
attr_accessor :options
attr_reader :output
- # A catch all for aguments passed to reviewer via the command-line.
+ # A catch all for aguments passed to reviewer via the command-line so they can be interpreted
+ # and made available via the relevant classes.
# @param options = ARGV [Hash] options to parse and extract the relevant values for a run
#
- # @return [Reviewer::Arguments] the full collection of arguments provided via the command line
+ # @example Using all options: `rvw keyword_one keyword_two --files ./example.rb,./example_test.rb --tags syntax`
+ # reviewer = Reviewer::Arguments.new
+ # reviewer.files.to_a # => ['./example.rb','./example_test.rb']
+ # reviewer.tags.to_a # => ['syntax']
+ # reviewer.keywords.to_a # => ['keyword_one', 'keyword_two']
+ #
+ # @return [self]
def initialize(options = ARGV)
@output = Output.new
@options = Slop.parse options do |opts|
opts.array '-f', '--files', 'a list of comma-separated files or paths', delimiter: ',', default: []
opts.array '-t', '--tags', 'a list of comma-separated tags', delimiter: ',', default: []
opts.on '-v', '--version', 'print the version' do
- @output.info VERSION
+ @output.help VERSION
exit
end
opts.on '-h', '--help', 'print the help' do
- @output.info opts
+ @output.help opts
exit
end
end
end