Process features after parsing command line options
350007
def parse_command_line(self):
        """"""
        result = _Distribution.parse_command_line(self)
        if self.features:
            self._finalize_features()
        return result
842534
def process_command_line(preset_command: nil)
      prompt = preset_command ? ":#{preset_command} " : ':'
      command_line.set_prompt prompt
      cmd, *args = command_line.get_command(prompt: prompt).split(' ')
      if cmd && !cmd.empty? && respond_to?(cmd)
        ret = self.public_send cmd, *args
        clear_command_line
        ret
      end
    rescue Interrupt
      clear_command_line
    end
845424
def process_options(arglist=None, parse_argv=False, config_file=None,
                    parser=None):
    
    if not parser:
        parser = get_parser()
    if not parser.has_option('--config'):
        group = parser.add_option_group("Configuration", description=(
            "The project options are read from the [%s] section of the "
            "tox.ini file or the setup.cfg file located in any parent folder "
            "of the path(s) being processed.  Allowed options are: %s." %
            (parser.prog, ', '.join(parser.config_options))))
        group.add_option('--config', metavar='path', default=config_file,
                         help="user config file location")
    # Don't read the command line if the module is used as a library.
    if not arglist and not parse_argv:
        arglist = []
    # If parse_argv is True and arglist is None, arguments are
    # parsed from the command line (sys.argv)
    (options, args) = parser.parse_args(arglist)
    options.reporter = None

    if options.ensure_value('testsuite', False):
        args.append(options.testsuite)
    elif not options.ensure_value('doctest', False):
        if parse_argv and not args:
            if options.diff or any(os.path.exists(name)
                                   for name in PROJECT_CONFIG):
                args = ['.']
            else:
                parser.error('input not specified')
        options = read_config(options, args, arglist, parser)
        options.reporter = parse_argv and options.quiet == 1 and FileReport

    options.filename = _parse_multi_options(options.filename)
    options.exclude = normalize_paths(options.exclude)
    options.select = _parse_multi_options(options.select)
    options.ignore = _parse_multi_options(options.ignore)

    if options.diff:
        options.reporter = DiffReport
        stdin = stdin_get_value()
        options.selected_lines = parse_udiff(stdin, options.filename, args[0])
        args = sorted(options.selected_lines)

    return options, args
338204
def _parse_options(self, migration):
        """"""
        options = migration.get('options', {})
        install_command = options.get('install_command')
        backup = options.get('backup')
        if backup:
            self.check_dict_expected_keys(
                {'command', 'ignore_if', 'stop_on_failure'},
                options['backup'], 'backup',
            )
            backup = MigrationBackupOption(
                command=backup.get('command'),
                ignore_if=backup.get('ignore_if'),
                stop_on_failure=backup.get('stop_on_failure', True),
            )
        return MigrationOption(
            install_command=install_command,
            backup=backup,
        )
402259
def _ParseProcessingOptions(self, options):
    
    argument_helper_names = [
        'process_resources', 'temporary_directory', 'zeromq']
    helpers_manager.ArgumentHelperManager.ParseOptions(
        options, self, names=argument_helper_names)

    worker_memory_limit = getattr(options, 'worker_memory_limit', None)

    if worker_memory_limit and worker_memory_limit < 0:
      raise errors.BadConfigOption(
          'Invalid worker memory limit value cannot be negative.')

    self._worker_memory_limit = worker_memory_limit
992477
def execute(self, callback=None):
        
        # Preprocess options to extract --settings and --pythonpath.
        # These options could affect the commands that are available, so they
        # must be processed early.
        self.parser = parser = NewOptionParser(prog=self.prog_name,
                             usage=self.usage_info,
#                             version=self.get_version(),
                             formatter = NewFormatter(),
                             add_help_option = False,
                             option_list=self.option_list)
        
        if not self.global_options:
            global_options, args = parser.parse_args(self.argv)
            global_options.apps_dir = os.path.normpath(os.path.join(global_options.project, 'apps'))
            handle_default_options(global_options)
            args = args[1:]
        else:
            global_options = self.global_options
            args = self.argv

        if global_options.envs:
            for x in global_options.envs:
                if '=' in x:
                    k, v = x.split('=')
                    os.environ[k.strip()] = v.strip()
                else:
                    print ('Error: environment variable definition (%s) format is not right, '
                           'shoule be -Ek=v or -Ek="a b"' % x)

        global_options.settings = global_options.settings or os.environ.get('SETTINGS', 'settings.ini')
        global_options.local_settings = global_options.local_settings or os.environ.get('LOCAL_SETTINGS', 'local_settings.ini')
        
        if callback:
            callback(global_options)
            
        if len(args) == 0:
            if global_options.version:
                print self.get_version()
                sys.exit(0)
            else:
                self.print_help(global_options)
                sys.ext(1)

        self.do_command(args, global_options)
651515
def parse_options(args) # :nodoc:
      option_parser_class = self.class.const_get("#{options[:subcommand_option_handling_strategy].to_s.capitalize}CommandOptionParser")
      OptionParsingResult.new.tap { |parsing_result|
        parsing_result.arguments = args
        parsing_result = @global_option_parser.parse!(parsing_result)
        option_parser_class.new(@accepts).parse!(parsing_result, options[:argument_handling_strategy])
      }
    end
475492
def run
      if parsed_options? && arguments_valid?
        puts "Start at #{DateTime.now}\n\n" if @options.verbose

        output_options if @options.verbose # [Optional]

        process_arguments
        process_command

        puts "\nFinished at #{DateTime.now}" if @options.verbose

      else
        puts "ERROR: Invalid Options passed. Please run with --help"
        exit 1
      end

    end
1075280
function postProcessing(tokens, options, source){

  function tokenName(token){
    return (token.prefix ? token.prefix + ':' : '') + token.name;
  }

  function getTokenAttrs(token){
    return token.attrs.reduce(function(res, attr){
      res[tokenName(attr)] = attr.value;
      return res;
    }, {});
  }

  function buildLocationIndex(){
    var line = 1;
    var column = 0;

    lineIdx = new Array(source.length);
    columnIdx = new Array(source.length);

    for (var i = 0; i < source.length + 1; i++)
    {
      lineIdx[i] = line;
      columnIdx[i] = column;

      if (source[i] === '\n')
      {
        line++;
        column = 0;
      }
      else
        column++;
    }
  }


  function findLocationByOffset(offset){
    return {
      line: lineIdx[offset],
      column: columnIdx[offset]
    };
  }

  function getLocationFromRange(range){
    return {
      start: findLocationByOffset(range.start_),
      end: findLocationByOffset(range.end_)
    };
  }

  function convertRange(token){
    if (options.loc)
    {
      token.loc = getLocationFromRange(token.range);
      if (token.valueRange)
        token.valueLoc = getLocationFromRange(token.valueRange);
    }

    if (options.range)
    {
      token.range = [token.range.start_, token.range.end_];
      if (token.valueRange)
        token.valueRange = [token.valueRange.start_, token.valueRange.end_];
    }
    else
    {
      delete token.range;
      delete token.valueRange;
    }
  }

  function walk(tokens){
    var token;
    var prev;

    for (var i = 0; token = tokens[i++]; prev = token)
    {
      // process element
      if (token.type == TYPE_ELEMENT)
      {
        // process attribute content
        var attrs = getTokenAttrs(token);
        for (var j = 0, attr; attr = token.attrs[j++];)
        {
          var mode = attr.name;

          // special case modification instruction in <b:include>
          if (token.prefix == 'b' && attr.name == 'value')
          {
            // parse value attribute in
            //   <b:class>/<b:append-class>/<b:set-class>/<b:remove-class>
            //   <b:attr name="name">/<b:append-attr name="name">/<b:set-attr name="name">/<b:remove-attr name="name">
            var m = token.name.match(ATTRIBUTE_MODE);
            if (m)
              mode = m[1] == 'class' ? 'class' : attrs.name;
          }

          // process bindings and decode HTML tokens
          processAttr(attr, mode, convertRange);

          convertRange(attr);
        }

        // walk recursive
        walk(token.children);
      }

      // process text
      if (token.type == TYPE_TEXT)
      {
        // decode HTML tokens in value
        token.value = decodeHTMLTokens(token.value);

        // try join text tokens
        if (!token.refs && prev && prev.type == TYPE_TEXT && !prev.refs)
        {
          prev.value += token.value;
          prev.end_ = token.end_;
          tokens.splice(--i, 1);
        }
      }

      // process comment
      if (token.type == TYPE_COMMENT)
      {
        // decode HTML tokens in value
        token.value = decodeHTMLTokens(token.value);
      }

      convertRange(token);
    }
  }

  var lineIdx;
  var columnIdx;

  if (options.loc)
    buildLocationIndex();

  walk(tokens);
}
270008
def process_options(opts):
    """"""
    # Convert match and exclude args into pattern lists
    match = opts.get("match")
    if match and type(match) is str:
        opts["match"] = [pat.strip() for pat in match.split(",")]
    elif match:
        assert type(match) is list
    else:
        opts["match"] = []

    exclude = opts.get("exclude")
    if exclude and type(exclude) is str:
        opts["exclude"] = [pat.strip() for pat in exclude.split(",")]
    elif exclude:
        assert type(exclude) is list
    else:
        # opts["exclude"] = DEFAULT_OMIT
        opts["exclude"] = []
809778
def parse_options():
    

    try:
        opts, args = getopt.getopt(sys.argv[1:], 'ac:e:hilms:t:vx',
                ['adapt', 'comp=', 'enum=', 'exhaust', 'help', 'incr', 'blo',
                    'minimize', 'solver=', 'trim=', 'verbose'])
    except getopt.GetoptError as err:
        sys.stderr.write(str(err).capitalize())
        usage()
        sys.exit(1)

    adapt = False
    exhaust = False
    cmode = None
    to_enum = 1
    incr = False
    blo = False
    minz = False
    solver = 'g3'
    trim = 0
    verbose = 1

    for opt, arg in opts:
        if opt in ('-a', '--adapt'):
            adapt = True
        elif opt in ('-c', '--comp'):
            cmode = str(arg)
        elif opt in ('-e', '--enum'):
            to_enum = str(arg)
            if to_enum != 'all':
                to_enum = int(to_enum)
            else:
                to_enum = 0
        elif opt in ('-h', '--help'):
            usage()
            sys.exit(0)
        elif opt in ('-i', '--incr'):
            incr = True
        elif opt in ('-l', '--blo'):
            blo = True
        elif opt in ('-m', '--minimize'):
            minz = True
        elif opt in ('-s', '--solver'):
            solver = str(arg)
        elif opt in ('-t', '--trim'):
            trim = int(arg)
        elif opt in ('-v', '--verbose'):
            verbose += 1
        elif opt in ('-x', '--exhaust'):
            exhaust = True
        else:
            assert False, 'Unhandled option: {0} {1}'.format(opt, arg)

    return adapt, blo, cmode, to_enum, exhaust, incr, minz, solver, trim, \
            verbose, args
817698
def run
      option_parser @options
      
      # Check on include version request.
      if @options[:version].value then
	puts "#{@name}, version #{@version}"
	exit
      end

      # Check on include help request.
      if ARGV[0] == 'help' or ARGV[0] == '--help' or ARGV[0] == '-h' then
	# Help arguments apsent, well then display information about application.
	if ARGV.size == 1 then
	  puts
	  puts "*** #{@name} ***".center(80)
	  # Display about info.
	  if @about.size > 0 then
	    puts '** ABOUT:'
	    @about.each do |line|
	      puts "  #{line}"
	    end
	  end
	  # Display usage info.
	  if @usage.size > 0 then
	    puts
	    puts '** USAGE:'
	    @usage.each do |line|
	      puts "  #{line}"
	    end
	  end
	  # Display options info.
	  puts
	  puts '** OPTIONS:'
	  display_options @options
	  # Display commands info
	  if @commands.size > 0 then
	    @commands.each do |c| c.init end
	    puts
	    puts '** COMMANDS:'
	    display_commands @commands
	    puts
	    puts "For details, type: help [COMMAND]"
	  end
	  puts
	# Help arguments exist, find command in application command list.
	else
	  ARGV.delete_at( 0 )
	  cmd = command_select
	  if ARGV.size != 0 then
	    puts "fatal error: unknown command '#{ARGV[0]}'"
	    exit
	  end
	  # Display describe information on command.
	  puts
	  puts Cmdlib::Describe.outtitle( cmd.name )
	  puts "  #{cmd.brief}"
	  if cmd.details.size > 0 then
	    puts
	    puts '** DETAILS:'
	    cmd.details.each do |e|
	      puts "  #{e}"
	    end
	  end
	  if cmd.example.size > 0 then
	    puts
	    puts '** EXAMPLE:'
	    cmd.example.each do |e|
	      puts "  #{e}"
	    end
	  end
	  # Display options info.
	  if cmd.options.size > 0 then
	    puts
	    puts '** OPTIONS:'	  
	    display_options cmd.options
	  end
	  # Display commands info.
	  if cmd.subcmd.size > 0 then
	    cmd.subcmd.each do |c| c.init end
	    puts
	    puts '** SUBCOMMANDS:'
	    display_commands cmd.subcmd
	    puts
	    puts "For details, type: help #{cmd.name} [SUBCOMMAND]"
	  end
	  puts
	end
	exit
      end
      
      # Handling default command (if exist her).
      if @default != nil then
	option_excess
	if ARGV.size < @default.argnum then
	  puts "fatal error: to few arguments for programm, use <help>."
	else
	  @default.handler( @options, ARGV )
	end
	exit
      end
      
      # Handling commands.
      cmd = command_select
      if cmd == nil then
	puts "fatal error: unknown command or command miss, use <help>."
	exit
      end
      if ARGV.size < cmd.argnum then
	puts "fatal error: to few arguments for command, use: <help> <command name>."
	exit
      end
      # Scaning options fir this command
      option_parser cmd.options
      option_excess
      #cmd.init
      cmd.handler( @options, ARGV )
      exit
    end
680514
def command_line_parsed(
            self,
            available_plugins: Set[Type[Plugin]],
            args_command_list: Any,
            malformed_servers: List[ServerStringParsingError]
    ) -> None:
        
958259
function parseOptions(opts) {
  opts = opts || {};
  var argv = [];
  var options = {};
  var process_argv = process.argv;
  for (var i = 2; i < process_argv.length; i++) {
    if (process_argv[i].indexOf('--') == 0) {
      var arg = process_argv[i];
      if (arg.indexOf("=") > 0) {
        var arg_kv = arg.split('=');
        arg = arg_kv[0];
        arg = arg.replace('--','');
        arg = replaceAll(arg, '-', '_');
        options[arg] = arg_kv[1];
        if (typeof opts[arg] == 'string') {
          if (opts[arg] == 'int' || opts[arg] == 'integer') {
            options[arg] = parseInt(options[arg]);
          } else if (opts[arg] == 'float') {
            options[arg] = parseFloat(options[arg]);
          }
        } else if (typeof opts[arg] == 'object') {
          if (opts[arg].type == 'array') {
            var sep = opts[arg].separator || opts[arg].sep || ',';
            options[arg] = options[arg].split(sep);
          }
        }
      } else {
        arg = arg.replace('--','');
        arg = replaceAll(arg, '-', '_');
        options[arg] = true;
      }
    } else {
      argv.push(process_argv[i]);
    }
  }
  options.argv = argv;
  return options;
}
177017
def feature_handler(self, cmd):
        """"""
        feature = cmd.feature_name
        if feature not in commands.FEATURE_NAMES:
            self.warning("feature %s is not supported - parsing may fail"
                % (feature,))
360789
def _process_option(self, tsocket, command, option):
        
        if option == ECHO:
            tsocket.sendall(IAC + DO + ECHO)
        elif command in (DO, DONT):
            tsocket.sendall(IAC + WONT + option)
        elif command in (WILL, WONT):
            tsocket.sendall(IAC + DONT + option)
1338770
def process_command(cmd, args)
      commands.each do |command, options|
        if (options[:case_sensitive]  && cmd == command) ||
           (!options[:case_sensitive] && cmd.downcase == command.downcase)
          #return options[:block].call(args)
          return instance_exec(args, &options[:block])
        end
      end
      throw :command_not_found
    end