Add a global option; follows the same syntax as Command#option
 This would be used for switches such as --version, --trace, etc.
500455
def global_option(*args, &block)
      switches, description = Runner.separate_switches_from_description(*args)
      @options << {
        args: args,
        proc: block,
        switches: switches,
        description: description,
      }
    end
566562
def __add_options(parser):
    
    g = parser.add_option_group('What to generate')
    g.add_option("-F", "--onefile", dest="onefile",
                 action="store_true", default=False,
                 help="create a single file deployment")
    g.add_option("-D", "--onedir", dest="onefile",
                 action="store_false",
                 help="create a single directory deployment (default)")
    g.add_option("-o", "--out",
                 dest="workdir", metavar="DIR",
                 help="generate the spec file in the specified directory "
                      "(default: current directory)")
    g.add_option("-n", "--name",
                 help="name to assign to the project "
                      "(default: first script's basename)")

    g = parser.add_option_group('What to bundle, where to search')
    g.add_option("-p", "--paths", default=[], dest="pathex",
                 metavar="DIR", action="append",
                 help="set base path for import (like using PYTHONPATH). "
                      "Multiple directories are allowed, separating them "
                      "with %s, or using this option multiple times"
                      % repr(os.pathsep))
    g.add_option("--additional-hooks-dir", action="append", dest="hookspath",
                 help="additional path to search for hooks "
                      "(may be given several times)")    
    g.add_option("-K", "--tk", action="store_true",
                 help="include TCL/TK in the deployment")
    g.add_option("-a", "--ascii", action="store_true",
                 help="do NOT include unicode encodings "
                      "(default: included if available)")

    g = parser.add_option_group('How to generate')
    g.add_option("-d", "--debug", action="store_true", default=False,
                 help=("use the debug (verbose) build of the executable for "
                       "packaging. This will make the packaged executable be "
                       "more verbose when run."))
    g.add_option("-s", "--strip", action="store_true",
                 help="strip the exe and shared libs "
                      "(don't try this on Windows)")
    g.add_option("--noupx", action="store_true", default=False,
                 help="do not use UPX even if available (works differently "
                      "between Windows and *nix)")
    #p.add_option("-Y", "--crypt", metavar="FILE",
    #             help="encrypt pyc/pyo files")

    g = parser.add_option_group('Windows and Mac OS X specific options')
    g.add_option("-c", "--console", "--nowindowed", dest="console",
                 action="store_true", default=True,
                 help="use a console subsystem executable (default)")
    g.add_option("-w", "--windowed", "--noconsole", dest="console",
                 action="store_false",
                 help="use a windowed subsystem executable, which on Windows "
                      "does not open the console when the program is launched."
                      'Mandatory whe creating .app bundle on Mac OS X')
    g.add_option("-i", "--icon", dest="icon_file",
                 metavar="FILE.ICO or FILE.EXE,ID or FILE.ICNS",
                 help="If FILE is an .ico file, add the icon to the final "
                      "executable. Otherwise, the syntax 'file.exe,id' to "
                      "extract the icon with the specified id "
                      "from file.exe and add it to the final executable. "
                      "If FILE is an .icns file, add the icon to the final "
                      ".app bundle on Mac OS X (for Mac not yet implemented)")

    g = parser.add_option_group('Windows specific options')
    g.add_option("--version-file",
                 dest="version_file", metavar="FILE",
                 help="add a version resource from FILE to the exe")
    g.add_option("-m", "--manifest", metavar="FILE or XML",
                 help="add manifest FILE or XML to the exe")
    g.add_option("-r", "--resource", default=[], dest="resources",
                 metavar="FILE[,TYPE[,NAME[,LANGUAGE]]]", action="append",
                 help="add/update resource of the given type, name and language "
                      "from FILE to the final executable. FILE can be a "
                      "data file or an exe/dll. For data files, atleast "
                      "TYPE and NAME need to be specified, LANGUAGE defaults "
                      "to 0 or may be specified as wildcard * to update all "
                      "resources of the given TYPE and NAME. For exe/dll "
                      "files, all resources from FILE will be added/updated "
                      "to the final executable if TYPE, NAME and LANGUAGE "
                      "are omitted or specified as wildcard *."
                      "Multiple resources are allowed, using this option "
                      "multiple times.")
795880
def add_commands(cmds):
    
    if not isinstance(cmds, Iterable):
        cmds = [cmds]

    for command in cmds:
        if command.__name__.endswith("Command"):
            globals()[command.__name__] = command
919277
def add_options(cls, manager):
        """"""
        kw = {}
        if flake8.__version__ >= '3.0.0':
            kw['parse_from_config'] = True
        manager.add_option(
            "--known-modules",
            action='store',
            default="",
            help=(
                "User defined mapping between a project name and a list of"
                " provided modules. For example: ``--known-modules=project:"
                "[Project],extra-project:[extras,utilities]``."
            ),
            **kw
        )
897292
def set_environment(self, name, value):
        
        args = ['set-environment']
        if self._add_option:
            args += [self._add_option]

        args += [name, value]

        proc = self.cmd(*args)

        if proc.stderr:
            if isinstance(proc.stderr, list) and len(proc.stderr) == int(1):
                proc.stderr = proc.stderr[0]
            raise ValueError('tmux set-environment stderr: %s' % proc.stderr)
1258578
def tool_options_from_global(global_options, num_jobs):
    """"""
    internal_opt = ["whitelist", "blacklist", "fix_what_you_can"]
    queue_object = _obtain_queue(num_jobs)
    translate = defaultdict(lambda: (lambda x: x),
                            log_technical_terms_to=lambda _: queue_object)

    tool_options = OrderedDict()

    for key in sorted(global_options.keys()):
        if key not in internal_opt and global_options[key] is not None:
            tool_options[key] = translate[key](global_options[key])

    return tool_options
279727
def cognate_options(self, arg_parser):
        
        arg_parser.add_argument('--service_name',
                                default=self.service_name,
                                help='This will set the name for the current '
                                     'instance. This will be reflected in the '
                                     'log output.')
        arg_parser.add_argument('--log_level',
                                default=self.log_level,
                                choices=['debug', 'info', 'warn', 'error'],
                                help='Set the log level for the log output.')
        arg_parser.add_argument('--log_path',
                                default=self.log_path,
                                help='Set the path for log output. The default '
                                     'file created is '
                                     '"<log_path>/<service_name>.log". If the '
                                     'path ends with a ".log" extension, then '
                                     'the path be a target file.')
        arg_parser.add_argument('--verbose',
                                action='store_true',
                                default=self.verbose,
                                help='Enable verbose log output to console. '
                                     'Useful for debugging.')
1138703
def add_command_line_options_optparse(cls, optparser):
        """"""

        def set_parameter(option, opt, value, parser):
            """callback function for OptionParser"""
            cls.config[opt] = value
            if opt == "--stomp-conf":
                cls.load_configuration_file(value)

        optparser.add_option(
            "--stomp-host",
            metavar="HOST",
            default=cls.defaults.get("--stomp-host"),
            help="Stomp broker address, default '%default'",
            type="string",
            nargs=1,
            action="callback",
            callback=set_parameter,
        )
        optparser.add_option(
            "--stomp-port",
            metavar="PORT",
            default=cls.defaults.get("--stomp-port"),
            help="Stomp broker port, default '%default'",
            type="int",
            nargs=1,
            action="callback",
            callback=set_parameter,
        )
        optparser.add_option(
            "--stomp-user",
            metavar="USER",
            default=cls.defaults.get("--stomp-user"),
            help="Stomp user, default '%default'",
            type="string",
            nargs=1,
            action="callback",
            callback=set_parameter,
        )
        optparser.add_option(
            "--stomp-pass",
            metavar="PASS",
            default=cls.defaults.get("--stomp-pass"),
            help="Stomp password",
            type="string",
            nargs=1,
            action="callback",
            callback=set_parameter,
        )
        optparser.add_option(
            "--stomp-prfx",
            metavar="PRE",
            default=cls.defaults.get("--stomp-prfx"),
            help="Stomp namespace prefix, default '%default'",
            type="string",
            nargs=1,
            action="callback",
            callback=set_parameter,
        )
        optparser.add_option(
            "--stomp-conf",
            metavar="CNF",
            default=cls.defaults.get("--stomp-conf"),
            help="Stomp configuration file containing connection information, disables default values",
            type="string",
            nargs=1,
            action="callback",
            callback=set_parameter,
        )
1051727
protected function setupExecution() {
    $this->setOptionsForLastCommand();
    $this->setGlobalOptions();

    $globalOptions = $this->arguments;

    foreach ($this->commands as $commandNumber => $command) {
      if ($this->alias) {
        $command = "@{$this->alias} {$command}";
      }

      $options = isset($this->options[$commandNumber]) ? $this->options[$commandNumber] : '';

      // Add in global options, as well as those set via option method.
      $command = $command . $options . $globalOptions;

      $this->exec($command)
        ->dir($this->dir);
    }
  }
543065
def add_options(options = {}, raw_options = nil)
      @options.merge!(options.stringify_keys) unless options.blank?
      @raw_options << raw_options unless raw_options.blank?
    end
952037
def add_local_option(self, *args, **kw):
        
        try:
            group = self.local_option_group
        except AttributeError:
            group = SConsOptionGroup(self, 'Local Options')
            group = self.add_option_group(group)
            self.local_option_group = group

        result = group.add_option(*args, **kw)

        if result:
            # The option was added successfully.  We now have to add the
            # default value to our object that holds the default values
            # (so that an attempt to fetch the option's attribute will
            # yield the default value when not overridden) and then
            # we re-parse the leftover command-line options, so that
            # any value overridden on the command line is immediately
            # available if the user turns around and does a GetOption()
            # right away.
            setattr(self.values.__defaults__, result.dest, result.default)
            self.reparse_local_options()

        return result
974837
def tox_addoption(parser):
    """"""
    parser.add_argument(
        '--travis-after', dest='travis_after', action='store_true',
        help='Exit successfully after all Travis jobs complete successfully.')

    if 'TRAVIS' in os.environ:
        pypy_version_monkeypatch()
        subcommand_test_monkeypatch(tox_subcommand_test_post)
316968
def require_option(current_ctx: click.Context, param_name: str) -> None:
    """"""

    ctx = current_ctx
    param_definition = None
    while ctx is not None:
        # ctx.command.params has the actual definition of the param. We use
        # this when raising the exception.
        param_definition = next(
            (p for p in ctx.command.params if p.name == param_name), None
        )

        # ctx.params has the current value of the parameter, as set by the user.
        if ctx.params.get(param_name):
            return
        ctx = ctx.parent

    assert param_definition, f"unknown parameter {param_name}"
    raise click.MissingParameter(ctx=current_ctx, param=param_definition)
1286291
def set_option(name, value):
    
    d = globals()

    if name in {'get_option', 'set_option'} or name not in d:
        from ..exceptions import PlotnineError
        raise PlotnineError("Unknown option {}".format(name))

    old = d[name]
    d[name] = value
    return old
818659
def setOptions(self, glob=False, **kwargs):
        
        if glob:
            self.globalOptions.update(kwargs)
        else:
            self.options.update(kwargs)
189129
def remove_global_options(options, args)
      # TODO: refactor with flipflop, please TJ ! have time to refactor me !
      options.each do |option|
        switches = option[:switches].dup
        next if switches.empty?

        if (switch_has_arg = switches.any? { |s| s =~ /[ =]/ })
          switches.map! { |s| s[0, s.index('=') || s.index(' ') || s.length] }
        end

        switches = expand_optionally_negative_switches(switches)

        past_switch, arg_removed = false, false
        args.delete_if do |arg|
          if switches.any? { |s| s[0, arg.length] == arg }
            arg_removed = !switch_has_arg
            past_switch = true
          elsif past_switch && !arg_removed && arg !~ /^-/
            arg_removed = true
          else
            arg_removed = true
            false
          end
        end
      end
    end
137902
def add_option(self, group):
        
        group.add_argument(
            "--{0}".format(self.option), action="store_true", help=self.name)