Resolve CLI option type name
975872
def resolve_type_name(ctx, param, value):  # pylint: disable=unused-argument
    """"""

    def _resolve(value):
        """Resolve single type name"""
        value = [
            type_id
            for type_id, type_name in W1ThermSensor.TYPE_NAMES.items()
            if type_name == value
        ][0]
        return value

    if not value:
        return value

    if isinstance(value, tuple):
        return [_resolve(v) for v in value]
    else:
        return _resolve(value)
421933
function parseOptions(type, options) {
    const ret = {
        indentChar: " ",
        indentSize: 2,
        attribute: 1,
        closeBracket: 0,
    }

    if (Number.isSafeInteger(type)) {
        ret.indentSize = type
    } else if (type === "tab") {
        ret.indentChar = "\t"
        ret.indentSize = 1
    }
    if (Number.isSafeInteger(options.attribute)) {
        ret.attribute = options.attribute
    }
    if (Number.isSafeInteger(options.closeBracket)) {
        ret.closeBracket = options.closeBracket
    }

    return ret
}
649253
def common_cli_output_options(f):
    """"""

    @click.option(
        "-d",
        "--debug",
        default=False,
        is_flag=True,
        help="Produce debug output during processing.",
    )
    @click.option(
        "-F",
        "--output-format",
        default="pretty",
        type=click.Choice(["pretty", "json", "pretty_json"]),
        help="Determines how output is formatted. This is only supported by a "
        "subset of the commands at the moment (e.g. list).",
    )
    @click.option(
        "-v",
        "--verbose",
        is_flag=True,
        default=False,
        help="Produce more output during processing.",
    )
    @click.pass_context
    @functools.wraps(f)
    def wrapper(ctx, *args, **kwargs):
        # pylint: disable=missing-docstring
        opts = config.get_or_create_options(ctx)
        opts.debug = kwargs.pop("debug")
        opts.output = kwargs.pop("output_format")
        opts.verbose = kwargs.pop("verbose")
        kwargs["opts"] = opts
        return ctx.invoke(f, *args, **kwargs)

    return wrapper
597631
def parse_options(args=None, config=True, rootdir=CURDIR, **overrides):  # noqa
    
    args = args or []

    # Parse args from command string
    options = PARSER.parse_args(args)
    options.file_params = dict()
    options.linters_params = dict()

    # Compile options from ini
    if config:
        cfg = get_config(str(options.options), rootdir=rootdir)
        for opt, val in cfg.default.items():
            LOGGER.info('Find option %s (%s)', opt, val)
            passed_value = getattr(options, opt, _Default())
            if isinstance(passed_value, _Default):
                if opt == 'paths':
                    val = val.split()
                if opt == 'skip':
                    val = fix_pathname_sep(val)
                setattr(options, opt, _Default(val))

        # Parse file related options
        for name, opts in cfg.sections.items():

            if name == cfg.default_section:
                continue

            if name.startswith('pylama'):
                name = name[7:]

            if name in LINTERS:
                options.linters_params[name] = dict(opts)
                continue

            mask = re.compile(fnmatch.translate(fix_pathname_sep(name)))
            options.file_params[mask] = dict(opts)

    # Override options
    _override_options(options, **overrides)

    # Postprocess options
    for name in options.__dict__:
        value = getattr(options, name)
        if isinstance(value, _Default):
            setattr(options, name, process_value(name, value.value))

    if options.concurrent and 'pylint' in options.linters:
        LOGGER.warning('Can\'t parse code asynchronously with pylint enabled.')
        options.concurrent = False

    return options
652443
def parse_option(self, option, block_name, *values):
        

        # treat arguments as part of the program name (support spaces in name)
        values = [x.replace(' ', '\\ ') if not x.startswith(os.sep) else x
                  for x in [str(v) for v in values]]

        if option == 'close':
            option = 'start_' + option

        key = option.split('_', 1)[0]
        self.paths[key] = set(common.extract_app_paths(values))
677301
def _options():
    """"""
    opts = sys.argv[1:]
    return [click.Option((v.split('=')[0],)) for v in opts
            if v[0] == '-' and v != '--help']
994736
def parse_cli_options!(args)
      unknown_opts = []

      parser = build_cli_parser

      begin
        parser.parse!(args)
      rescue OptionParser::InvalidOption => e
        unknown_opts << e.args[0]
        unless args.size.zero?
          unknown_opts << args.shift unless args.first.start_with?("-")
          retry
        end
      end

      unknown_opts
    end
780110
function getOptionName (arg) {
  if (re.short.test(arg)) {
    return arg.match(re.short)[1]
  } else if (isLongOption(arg)) {
    return arg.match(re.long)[1]
  } else if (isOptionEqualsNotation(arg)) {
    return arg.match(re.optEquals)[1].replace(/^--/, '')
  } else {
    return null
  }
}
743930
def fix_config(self, options):
        
        options = super(CommandlineToAny, self).fix_config(options)

        opt = "wrapper"
        if opt not in options:
            options[opt] = "weka.core.classes.OptionHandler"
        if opt not in self.help:
            self.help[opt] = "The name of the wrapper class to use (string)."

        return options
283269
function getResolvedPath(options, type = 'html') {
  const explicitPathKey = `${ type }Path`

  if (options[explicitPathKey]) {
    return path.resolve(options[explicitPathKey])
  }

  return path.resolve(options.outputDir, `${ options.fontName }.${ type }`)
}
834686
def get_cli():
    """"""
    parser = argparse.ArgumentParser(
        prog="auto_version",
        description="auto version v%s: a tool to control version numbers" % __version__,
    )
    parser.add_argument(
        "--target",
        action="append",
        default=[],
        help="Files containing version info. "
        "Assumes unique variable names between files. (default: %s)."
        % (config.targets,),
    )
    parser.add_argument(
        "--bump",
        choices=SemVerSigFig,
        help="Bumps the specified part of SemVer string. "
        "Use this locally to correctly modify the version file.",
    )
    parser.add_argument(
        "--news",
        "--file-triggers",
        action="store_true",
        dest="file_triggers",
        help="Detects need to bump based on presence of files (as specified in config).",
    )
    parser.add_argument(
        "--set",
        help="Set the SemVer string. Use this locally to set the project version explicitly.",
    )
    parser.add_argument(
        "--set-patch-count",
        action="store_true",
        help="Sets the patch number to the commit count.",
    )
    parser.add_argument(
        "--lock",
        action="store_true",
        help="Locks the SemVer string. "
        "Lock will remain for another call to autoversion before being cleared.",
    )
    parser.add_argument(
        "--release",
        action="store_true",
        default=False,
        help="Marks as a release build, which flags the build as released.",
    )
    parser.add_argument(
        "--version",
        action="store_true",
        default=False,
        help="Prints the version of auto_version itself (self-version).",
    )
    parser.add_argument("--config", help="Configuration file path.")
    parser.add_argument(
        "-v",
        "--verbosity",
        action="count",
        default=0,
        help="increase output verbosity. " "can be specified multiple times",
    )
    return parser.parse_known_args()
518213
function getCommandlineOptions () {
  "use strict";
  var ret = { };
  const knownArgs = {
    "-k": "stopAfterFirstErrors",
    "-h": "printAsHTML",
    "-j": "printAsJSON",
    "-l": "onlyListFailures",
    "-v": "reportPassingFiles"
  };
  while (process.argv.length > 2 && process.argv[2] in knownArgs) {
    ret[knownArgs[process.argv[2]]] = true;
    process.argv.splice(2, 1);
  }
  if (process.argv.length < 3 || Object.keys(process.argv).length === 0 && process.argv.length < 4)
    throw "Usage: "+process.argv[1]+" [-h] [-j] [-l] [-v] [-k] <JSG file> <JSON file..>";
  ret.schema = process.argv[2];
  ret.data = process.argv.slice(3);
  return ret;
}
246627
function parseChangeDirectoryOptions (options) {
		var parsedOptions = {
			'changeDir': false,
			'path': '/',
		};
		if(options) {
			if(options.path) {
				parsedOptions.path = options.path;
				parsedOptions.changeDir = true;
			}
		}
		return parsedOptions;
	}
1191847
def option_excess
      ARGV.each do |opt|
	o = getopt( opt )
	if o[:n] != '' then
	  puts "fatal error: unknown option '#{o[:t]}#{o[:n]}'"
	  exit
	end
      end
    end
845152
function fixupCompilerOptions(options, diagnostics) {
        // Lazily create this value to fix module loading errors.
        commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || ts.filter(ts.optionDeclarations, function (o) {
            return typeof o.type === "object" && !ts.forEachProperty(o.type, function (v) { return typeof v !== "number"; });
        });
        options = ts.clone(options);
        var _loop_3 = function(opt) {
            if (!ts.hasProperty(options, opt.name)) {
                return "continue";
            }
            var value = options[opt.name];
            // Value should be a key of opt.type
            if (typeof value === "string") {
                // If value is not a string, this will fail
                options[opt.name] = ts.parseCustomTypeOption(opt, value, diagnostics);
            }
            else {
                if (!ts.forEachProperty(opt.type, function (v) { return v === value; })) {
                    // Supplied value isn't a valid enum value.
                    diagnostics.push(ts.createCompilerDiagnosticForInvalidCustomType(opt));
                }
            }
        };
        for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) {
            var opt = commandLineOptionsStringToEnum_1[_i];
            _loop_3(opt);
        }
        return options;
    }
1056595
function translateOptions(cliOptions) {
    return {
        envs: cliOptions.env,
        extensions: cliOptions.ext,
        rules: cliOptions.rule,
        plugins: cliOptions.plugin,
        globals: cliOptions.global,
        ignore: cliOptions.ignore,
        ignorePath: cliOptions.ignorePath,
        ignorePattern: cliOptions.ignorePattern,
        configFile: cliOptions.config,
        rulePaths: cliOptions.rulesdir,
        useEslintrc: cliOptions.eslintrc,
        parser: cliOptions.parser,
        parserOptions: cliOptions.parserOptions,
        cache: cliOptions.cache,
        cacheFile: cliOptions.cacheFile,
        cacheLocation: cliOptions.cacheLocation,
        fix: (cliOptions.fix || cliOptions.fixDryRun) && (cliOptions.quiet ? quietFixPredicate : true),
        fixTypes: cliOptions.fixType,
        allowInlineConfig: cliOptions.inlineConfig,
        reportUnusedDisableDirectives: cliOptions.reportUnusedDisableDirectives
    };
}
1106201
private Option resolveOption(String name) {
        name = OptionUtils.stripLeadingHyphens(name);
        for (Option option : options) {
            if (name.equals(option.getName())) {
                return option;
            }
            if (name.equals(option.getLongName())) {
                return option;
            }
        }
        return null;
    }