Add program options.
1210
def add_options(self):
        
        super(MetafileChanger, self).add_options()

        self.add_bool_option("-n", "--dry-run",
            help="don't write changes to disk, just tell what would happen")
        self.add_bool_option("-V", "--no-skip",
            help="do not skip broken metafiles that fail the integrity check")
        self.add_value_option("-o", "--output-directory", "PATH",
            help="optional output directory for the modified metafile(s)")
        self.add_bool_option("-p", "--make-private",
            help="make torrent private (DHT/PEX disabled)")
        self.add_bool_option("-P", "--make-public",
            help="make torrent public (DHT/PEX enabled)")
        self.add_value_option("-s", "--set", "KEY=VAL [-s ...]",
            action="append", default=[],
            help="set a specific key to the given value; omit the '=' to delete a key")
        self.add_value_option("-r", "--regex", "KEYcREGEXcSUBSTc [-r ...]",
            action="append", default=[],
            help="replace pattern in a specific key by the given substitution")
        self.add_bool_option("-C", "--clean",
            help="remove all non-standard data from metafile outside the info dict")
        self.add_bool_option("-A", "--clean-all",
            help="remove all non-standard data from metafile including inside the info dict")
        self.add_bool_option("-X", "--clean-xseed",
            help="like --clean-all, but keep libtorrent resume information")
        self.add_bool_option("-R", "--clean-rtorrent",
            help="remove all rTorrent session data from metafile")
        self.add_value_option("-H", "--hashed", "--fast-resume", "DATAPATH",
            help="add libtorrent fast-resume information (use {} in place of the torrent's name in DATAPATH)")
        # TODO: chtor --tracker
        ##self.add_value_option("-T", "--tracker", "DOMAIN",
        ##    help="filter given torrents for a tracker domain")
        self.add_value_option("-a", "--reannounce", "URL",
            help="set a new announce URL, but only if the old announce URL matches the new one")
        self.add_value_option("--reannounce-all", "URL",
            help="set a new announce URL on ALL given metafiles")
        self.add_bool_option("--no-ssl",
            help="force announce URL to 'http'")
        self.add_bool_option("--no-cross-seed",
            help="when using --reannounce-all, do not add a non-standard field to the info dict ensuring unique info hashes")
        self.add_value_option("--comment", "TEXT",
            help="set a new comment (an empty value deletes it)")
        self.add_bool_option("--bump-date",
            help="set the creation date to right now")
        self.add_bool_option("--no-date",
            help="remove the 'creation date' field")
1017032
def init_app(self, app):
        """"""
        app.cli.add_command(upgrader_cmd)
        app.extensions['invenio-upgrader'] = self
846135
def add_options(self):
        
        super(RtorrentControl, self).add_options()

        # basic options
        self.add_bool_option("--help-fields",
            help="show available fields and their description")
        self.add_bool_option("-n", "--dry-run",
            help="don't commit changes, just tell what would happen")
        self.add_bool_option("--detach",
            help="run the process in the background")
        self.prompt.add_options()

        # output control
        self.add_bool_option("-S", "--shell",
            help="escape output following shell rules")
        self.add_bool_option("-0", "--nul", "--print0",
            help="use a NUL character instead of a linebreak after items")
        self.add_bool_option("-c", "--column-headers",
            help="print column headers")
        self.add_bool_option("-+", "--stats",
            help="add sum / avg / median of numerical fields")
        self.add_bool_option("--summary",
            help="print only statistical summary, without the items")
        #self.add_bool_option("-f", "--full",
        #    help="print full torrent details")
        self.add_bool_option("--json",
            help="dump all items as JSON (use '-o f1,f2,...' to specify fields)")
        self.add_value_option("-o", "--output-format", "FORMAT",
            help="specify display format (use '-o-' to disable item display)")
        self.add_value_option("-O", "--output-template", "FILE",
            help="pass control of output formatting to the specified template")
        self.add_value_option("-s", "--sort-fields", "[-]FIELD[,...] [-s...]",
            action='append', default=[],
            help="fields used for sorting, descending if prefixed with a '-'; '-s*' uses output field list")
        self.add_bool_option("-r", "--reverse-sort",
            help="reverse the sort order")
        self.add_value_option("-A", "--anneal", "MODE [-A...]",
            type='choice', action='append', default=[],
            choices=('dupes+', 'dupes-', 'dupes=', 'invert', 'unique'),
            help="modify result set using some pre-defined methods")
        self.add_value_option("-/", "--select", "[N-]M",
            help="select result subset by item position (counting from 1)")
        self.add_bool_option("-V", "--view-only",
            help="show search result only in default ncurses view")
        self.add_value_option("--to-view", "--to", "NAME",
            help="show search result only in named ncurses view")
        self.add_bool_option("--append-view", "--append",
            help="DEPRECATED: use '--alter append' instead")
        self.add_value_option("--alter-view", "--alter", "MODE",
            type='choice', default=None, choices=self.ALTER_MODES,
            help="alter view according to mode: {} (modifies -V and --to behaviour)"
                 .format(', '.join(self.ALTER_MODES)))
        self.add_bool_option("--tee-view", "--tee",
            help="ADDITIONALLY show search results in ncurses view (modifies -V and --to behaviour)")
        self.add_value_option("--from-view", "--from", "NAME",
            help="select only items that are on view NAME (NAME can be an info hash to quickly select a single item)")
        self.add_value_option("-M", "--modify-view", "NAME",
            help="get items from given view and write result back to it (short-cut to combine --from-view and --to-view)")
        self.add_value_option("-Q", "--fast-query", "LEVEL",
            type='choice', default='=', choices=('=', '0', '1', '2'),
            help="enable query optimization (=: use config; 0: off; 1: safe; 2: danger seeker)")
        self.add_value_option("--call", "CMD",
            help="call an OS command pattern in the shell")
        self.add_value_option("--spawn", "CMD [--spawn ...]",
            action="append", default=[],
            help="execute OS command pattern(s) directly")
# TODO: implement -S
#        self.add_bool_option("-S", "--summary",
#            help="print statistics")

        # torrent state change (actions)
        for action in self.ACTION_MODES:
            action.setdefault("label", action.name.upper())
            action.setdefault("method", action.name)
            action.setdefault("interactive", False)
            action.setdefault("argshelp", "")
            action.setdefault("args", ())
            if action.argshelp:
                self.add_value_option(*action.options + (action.argshelp,),
                    **{"help": action.help + (" (implies -i)" if action.interactive else "")})
            else:
                self.add_bool_option(*action.options,
                    **{"help": action.help + (" (implies -i)" if action.interactive else "")})
        self.add_value_option("--ignore", "|".join(self.IGNORE_OPTIONS),
            type="choice", choices=self.IGNORE_OPTIONS,
            help="set 'ignore commands' status on torrent")
        self.add_value_option("--prio", "|".join(self.PRIO_OPTIONS),
            type="choice", choices=self.PRIO_OPTIONS,
            help="set priority of torrent")
        self.add_bool_option("-F", "--flush", help="flush changes immediately (save session data)")
413093
def add_command(self, cmd_name, *args):
        """"""
        self.__commands.append(Command(cmd_name, args))
1320708
def add_option(self, K=None, price=None, St=None, kind="call", pos="long"):
        """"""
        kinds = {
            "call": Call,
            "Call": Call,
            "c": Call,
            "C": Call,
            "put": Put,
            "Put": Put,
            "p": Put,
            "P": Put,
        }
        St = self.St if St is None else St
        option = kinds[kind](St=St, K=K, price=price, pos=pos)
        self.options.append(option)
586319
function addOptions() {
		if ( is_array( $this->options ) )
			extract( $this->options, EXTR_SKIP );

		global $themecolors;

		if ( empty($bg) )
			$bg = isset( $themecolors['bg'] ) ? $themecolors['bg'] : 'transparent';
		if ( empty($fg) )
			$fg = isset( $themecolors['text'] ) ? $themecolors['text'] : '000000';

		if ( empty( $method ) )
			$method = 'Automattic_Latex_WPCOM';

		if ( empty( $css ) )
			$css = 'img.latex { vertical-align: middle; border: none; background: none; }';

		if ( empty( $wrapper ) )
			$wrapper = false;

		$this->options = compact( 'bg', 'fg', 'method', 'css', 'wrapper' );
		update_option( 'pb_latex', $this->options );
	}
678974
def program_options(self, args):
        """"""
        options = {}
        for name, rule in self.option_rules.items():
            val = rule(args)
            if val is not None:
                options[name] = val
        return options
677301
def _options():
    """"""
    opts = sys.argv[1:]
    return [click.Option((v.split('=')[0],)) for v in opts
            if v[0] == '-' and v != '--help']
755412
def p_program(self, p):
        """"""
        p[0] = self.asttypes.ES5Program(p[1])
        p[0].setpos(p)
749003
def add(self, items):
        """"""
        options = self._create_options(items)
        for k, v in options.items():
            if k in self.labels and v not in self.items:
                options.pop(k)
                count = 0
                while f'{k}_{count}' in self.labels:
                    count += 1
                options[f'{k}_{count}'] = v
        self.widget.options.update(options)
        self.widget.param.trigger('options')
        self.widget.value = list(options.values())[:1]
584996
def initialize_options(self):
        """"""
        install.initialize_options(self)

        # leave the proper script according to the platform
        script = SCRIPT_WIN if sys.platform == "win32" else SCRIPT_REST
        self.distribution.scripts = [script]
1012616
def install(replace_existing=False):
    """"""
    bunch = AutoBunch()
    bunch.name = 'DAPA'
    bunch.protocol = 'dapa'
    bunch.force = 'true'
    # bunch.delay=200

    install_programmer('dapa', bunch, replace_existing=replace_existing)
604427
def options(self, parser, env):
        
        Plugin.options(self, parser, env)
        parser.add_option('--filetype', action='append',
                          help='Specify additional filetypes to monitor.')
1080499
def add(self, callback=None, name=None, shortcut=None, alias=None,
            docstring=None, menu=None, verbose=True):
        """"""
        if callback is None:
            # Allow to use either add(func) or @add or @add(...).
            return partial(self.add, name=name, shortcut=shortcut,
                           alias=alias, menu=menu)
        assert callback

        # Get the name from the callback function if needed.
        name = name or callback.__name__
        alias = alias or _alias(name)
        name = name.replace('&', '')
        shortcut = shortcut or self._default_shortcuts.get(name, None)

        # Skip existing action.
        if name in self._actions_dict:
            return

        # Set the status tip from the function's docstring.
        docstring = docstring or callback.__doc__ or name
        docstring = re.sub(r'[ \t\r\f\v]{2,}', ' ', docstring.strip())

        # Create and register the action.
        action = _create_qaction(self.gui, name, callback,
                                 shortcut,
                                 docstring=docstring,
                                 alias=alias,
                                 )
        action_obj = Bunch(qaction=action, name=name, alias=alias,
                           shortcut=shortcut, callback=callback, menu=menu)
        if verbose and not name.startswith('_'):
            logger.log(5, "Add action `%s` (%s).", name,
                       _get_shortcut_string(action.shortcut()))
        self.gui.addAction(action)
        # Add the action to the menu.
        menu = menu or self.menu
        # Do not show private actions in the menu.
        if menu and not name.startswith('_'):
            self.gui.get_menu(menu).addAction(action)
        self._actions_dict[name] = action_obj
        # Register the alias -> name mapping.
        self._aliases[alias] = name

        # Set the callback method.
        if callback:
            setattr(self, name, callback)
650589
def add_tasks(config, tasks_file, tasks_type, priority, redundancy):
    """"""
    res = _add_tasks(config, tasks_file, tasks_type, priority, redundancy)
    click.echo(res)
10854
def addopt ( opt )
      raise TypeError, 'Incorrectly types for option object.' unless
	opt.instance_of? Cmdlib::Option

      @options[opt.longname.to_sym] = opt
    end
878798
def add_options(self):
        
        super(RtorrentQueueManager, self).add_options()
        self.jobs = None
        self.httpd = None

        # basic options
        self.add_bool_option("-n", "--dry-run",
            help="advise jobs not to do any real work, just tell what would happen")
        self.add_bool_option("--no-fork", "--fg", help="Don't fork into background (stay in foreground and log to console)")
        self.add_bool_option("--stop", help="Stop running daemon")
        self.add_bool_option("--restart", help="Stop running daemon, then fork into background")
        self.add_bool_option("-?", "--status", help="Check daemon status")
        self.add_value_option("--pid-file", "PATH",
            help="file holding the process ID of the daemon, when running in background")
        self.add_value_option("--guard-file", "PATH",
            help="guard file for the process watchdog")