Class: HamlLint::Options
- Inherits:
-
Object
- Object
- HamlLint::Options
- Defined in:
- lib/haml_lint/options.rb
Overview
Handles option parsing for the command line application.
Instance Method Summary collapse
-
#parse(args) ⇒ Hash
Parses command line options into an options hash.
Instance Method Details
#parse(args) ⇒ Hash
Parses command line options into an options hash.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/haml_lint/options.rb', line 10 def parse(args) @options = {} OptionParser.new do |parser| parser. = "Usage: #{APP_NAME} [options] [file1, file2, ...]" parser parser parser parser parser end.parse!(args) # Any remaining arguments are assumed to be files @options[:files] = args.empty? ? ["."] : args @options rescue OptionParser::InvalidOption => ex raise Exceptions::InvalidCLIOption, ex., ex.backtrace end |