lib/mixlib/cli.rb
def parse_options(argv = ARGV)
      argv = argv.dup
      opt_parser.parse!(argv)

      # Deal with any required values
      options.each do |opt_key, opt_value|
        if opt_value[:required] && !config.key?(opt_key)
          reqarg = opt_value[:short] || opt_value[:long]
          puts "You must supply #{reqarg}!"
          puts @opt_parser
          exit 2
        end
        if opt_value[:in]
          unless opt_value[:in].kind_of?(Array)
            raise(ArgumentError, "Options config key :in must receive an Array")
          end
          if config[opt_key] && !opt_value[:in].include?(config[opt_key])
            reqarg = opt_value[:short] || opt_value[:long]
            puts "#{reqarg}: #{config[opt_key]} is not included in the list ['#{opt_value[:in].join("', '")}'] "
            puts @opt_parser
            exit 2
          end
        end
      end

      @cli_arguments = argv
      argv
    end
def parse_options(argv = ARGV)
      argv = argv.dup
      opt_parser.parse!(argv)

      # Deal with any required values
      options.each do |opt_key, opt_value|
        if opt_value[:required] && !config.key?(opt_key)
          reqarg = opt_value[:short] || opt_value[:long]
          puts "You must supply #{reqarg}!"
          puts @opt_parser
          exit 2
        end
        if opt_value[:in]
          unless opt_value[:in].kind_of?(Array)
            raise(ArgumentError, "Options config key :in must receive an Array")
          end
          if config[opt_key] && !opt_value[:in].include?(config[opt_key])
            reqarg = opt_value[:short] || opt_value[:long]
            puts "#{reqarg}: #{config[opt_key]} is not included in the list ['#{opt_value[:in].join("', '")}'] "
            puts @opt_parser
            exit 2
          end
        end
      end

      @cli_arguments = argv
      argv
    end
Create a new Mixlib::CLI class.  If you override this, make sure you call super!

 === Parameters
 *args<Array>:: The array of arguments passed to the initializer

 === Returns
 object<Mixlib::Config>:: Returns an instance of whatever you wanted :)
 Parses an array, by default ARGV, for command line options (as configured at
 the class level).
 === Parameters
 argv<Array>:: The array of arguments to parse; defaults to ARGV

 === Returns
 argv<Array>:: Returns any un-parsed elements.