lib/haml_lint/options.rb
# Parses command line options into an options hash.
#
# @param args [Array<String>] arguments passed via the command line
# @return [Hash] parsed options
Parses command line options into an options hash.
Parses command line options into an options hash .
def parse(args)
      @options = {}
      OptionParser.new do |parser|
        parser.banner = "Usage: #{APP_NAME} [options] [file1, file2, ...]"
        add_linter_options parser
        add_file_options parser
        add_info_options parser
      end.parse!(args)
      @options[:files] = args
      @options
    rescue OptionParser::InvalidOption => ex
      raise Exceptions::InvalidCLIOption,
            ex.message,
            ex.backtrace
    end
def parse ( args ) @options = { } OptionParser . new do | parser | parser . banner = "Usage: #{APP_NAME} [options] [file1, file2, ...]" add_linter_options parser add_file_options parser add_info_options parser end . parse! ( args ) @options [ :files ] = args @options rescue OptionParser :: InvalidOption => ex raise Exceptions :: InvalidCLIOption , ex . message , ex . backtrace end
Parses command line options into an options hash.
Parses command line options into an options hash .
# Any remaining arguments are assumed to be files
None
Hash
args
arguments passed via the command line
arguments passed via the command line