def __init__(self, asl_fname_opt="-i", ignore_stdopt=None, *args, **kwargs): """ :param asl_fname_opt: Option which identifies the filename of ASL data :param ignore_stdopt: List of standard options to ignore (because they are not useful in this context) """ OptionParser.__init__(self, *args, **kwargs) self.ignore_stdopt = [] if ignore_stdopt is not None: self.ignore_stdopt = ignore_stdopt g = OptionGroup(self, "Input data") self._add(g, asl_fname_opt, dest="asldata", help="ASL data file") self._add(g, "--order", dest="order", help="Data order as sequence of 2 or 3 characters: t=TIs/PLDs, r=repeats, p/P=TC/CT pairs. First character is fastest varying", default="prt") self._add(g, "--tis", dest="tis", help="TIs as comma-separated list") self._add(g, "--plds", dest="plds", help="PLDs as comma-separated list") self._add(g, "--nrpts", dest="nrpts", help="Fixed number of repeats per TI", default=None) self._add(g, "--rpts", dest="rpts", help="Variable repeats as comma-separated list, one per TI", default=None) self._add(g, "--t1", dest="t1", help="T1 image") self._add(g, "--t1b", dest="t1b", help="Blood t1", type=float, default=1.65) self._add(g, "--te", dest="te", help="Echo time", type=float, default=0.012) self._add(g, "--alpha", dest="alpha", help="", type=float, default=0.98) self._add(g, "--lambda", dest="lam", help="", type=float, default=0.9) self._add(g, "--debug", dest="debug", help="Debug mode", action="store_true", default=False) self.add_option_group(g) g = OptionGroup(self, "Preprocessing") self._add(g, "--diff", dest="diff", help="Perform tag-control subtraction", action="store_true", default=False) self._add(g, "--smooth", dest="smooth", help="Spatially smooth data", action="store_true", default=False) self._add(g, "--fwhm", dest="fwhm", help="FWHM for spatial filter kernel", type="float", default=6) self._add(g, "--mc", dest="mc", help="Motion correct data", action="store_true", default=False) self._add(g, "--reorder", dest="reorder", help="Re-order data in specified order") self.add_option_group(g)
def __init__(self, *args): OptionParser.__init__(self, *args) self.__custom_paths = self.__get_custom_paths() self.add_option('--music', help='input (music) directory', **self.__default_d('music')) self.add_option('--irank', help='output (irank playlist) directory', **self.__default_d('irank')) self.add_option('-c', '--config', help='config file (%default)', default=config_file('playlists')) self.add_option('-v', '--verbose', action='store_true')
def __init__(self, command, prefix='', usage=None, sections=[]): """ @param command: the command to build the config parser for @type command: C{str} @param prefix: A prefix to add to all command line options @type prefix: C{str} @param usage: a usage description @type usage: C{str} @param sections: additional (non optional) config file sections to parse @type sections: C{list} of C{str} """ self.command = command self.sections = sections self.prefix = prefix self.config = {} self.config_files = self.get_config_files() self.parse_config_files() self.valid_options = [] if self.command.startswith('git-') or self.command.startswith('gbp-'): prog = self.command else: prog = "gbp %s" % self.command OptionParser.__init__(self, option_class=GbpOption, prog=prog, usage=usage, version='%s %s' % (self.command, gbp_version))
def __init__(self, usage="", version=__version__, **kwargs): OptionParser.__init__(self, usage=usage, version=version, option_class=_ImageOption, **kwargs) self._categories = defaultdict(list)
def __init__(self, *args, **kwargs): self.myepilog = None try: self.myepilog = kwargs.pop('epilog') except KeyError: pass OptionParser.__init__(self, *args, **kwargs)
def __init__(self): OptionParser.__init__(self) self.add_option( "--xre-path", action="store", type="string", dest="xre_path", default=None, help= "absolute path to directory containing XRE (probably xulrunner)") self.add_option( "--symbols-path", action="store", type="string", dest="symbols_path", default=None, help= "absolute path to directory containing breakpad symbols, or the URL of a zip file containing symbols" ) self.add_option("--skip-manifest", action="store", type="string", dest="manifest_file", default=None, help="absolute path to a manifest file")
def __init__(self, **kwargs): # a bit awkward, but in place as a sort of memoizing if 'formatter' not in kwargs: kwargs['formatter'] = self.formatter_nonexpert OptionParser.__init__(self, **kwargs) self.formatter_expert.set_parser(self) # ensure %default expansion self.description_raw = ''
def __init__(self, **kwargs): # Fake a version so we can lazy load it later. # This is due to internals of OptionParser, but it's # fine kwargs["version"] = 1 kwargs["option_class"] = LazyHelpOption OptionParser.__init__(self, **kwargs)
def __init__(self): usage = "Usage: %prog [options] arg" OptionParser.__init__(self, usage) self.add_option("-e", "--exes", action="store_true", dest="print_exes", default=False, help="Print the path of executables found") self.add_option("-l", "--libs", action="store_true", dest="print_libs", default=False, help="Print the path of libraries found") self.add_option("-c", "--copy", action="store_true", dest="copy", default=False, help="Copy missing libraries from base system to target") self.add_option("-b", "--basedir", dest="basedir", default="", help="Directory where I can find the libraries") self.add_option("-d", "--libdir", dest="libdir", default="", help="Directory where I'm going to put the libraries") self._options, self._args = self.parse_args() if (len(self._args) != 1) or (not os.path.isdir(self._args[0])): self.error("You must supply a directory") if (self._options.copy and not (self._options.basedir != "")): self.error("To copy libraries, tell me where to find it \ (use -b option)") if (self._options.copy and not (self._options.libdir != "")): self.error("To copy libraries, tell me where to copy it \ (use -d option)")
def __init__(self, *args, **kwargs): if kwargs.has_key('option_class'): if not issubclass(kwargs['option_class'], self._option): raise Exception, "option_class must be a subclass of %s" % self._option.__name__ else: kwargs['option_class'] = self._option OptionParser.__init__(self, *args, **kwargs)
def __init__(self): OptionParser.__init__(self) self.add_option("--cwd", dest="cwd", default=os.getcwd(), help="absolute path to directory from which " "to run the binary") self.add_option("--xre-path", dest="xre_path", default=None, help="absolute path to directory containing XRE " "(probably xulrunner)") self.add_option("--symbols-path", dest="symbols_path", default=None, help="absolute path to directory containing breakpad " "symbols, or the URL of a zip file containing " "symbols") self.add_option("--utility-path", dest="utility_path", default=None, help="path to a directory containing utility program binaries") self.add_option("--enable-webrender", action="store_true", dest="enable_webrender", default=False, help="Enable the WebRender compositor in Gecko.")
def __init__(self, usage='%prog [options] filename', version='%%prog (%s %s)' % (__appname__, __version__), epilog=None, gui_mode=False, conflict_handler='resolve', **kwds): import textwrap from calibre.utils.terminal import colored usage = textwrap.dedent(usage) if epilog is None: epilog = _('Created by ') + colored(__author__, fg='cyan') usage += '\n\n' + _( '''Whenever you pass arguments to %prog that have spaces in them, ''' '''enclose the arguments in quotation marks.''') + '\n' _OptionParser.__init__(self, usage=usage, version=version, epilog=epilog, formatter=CustomHelpFormatter(), conflict_handler=conflict_handler, **kwds) self.gui_mode = gui_mode if False: # Translatable string from optparse _("Options") _("show this help message and exit") _("show program's version number and exit")
def __init__(self, usage, argdoc=None, comms=False, noforce=False, jset=False, multitask=False, multitask_nocycles=False, prep=False, auto_add=True, icp=False, color=True): self.auto_add = auto_add if argdoc is None: if prep: argdoc = [('SUITE', 'Suite name or path')] else: argdoc = [('REG', 'Suite name')] # noforce=True is for commands not using interactive prompts at all if multitask: usage += self.MULTITASKCYCLE_USAGE elif multitask_nocycles: # glob on task names but not cycle points usage += self.MULTITASK_USAGE args = "" self.n_compulsory_args = 0 self.n_optional_args = 0 self.unlimited_args = False self.comms = comms self.jset = jset self.noforce = noforce self.prep = prep self.icp = icp self.suite_info = [] self.color = color maxlen = 0 for arg in argdoc: if len(arg[0]) > maxlen: maxlen = len(arg[0]) if argdoc: usage += "\n\nArguments:" for arg in argdoc: if arg[0].startswith('['): self.n_optional_args += 1 else: self.n_compulsory_args += 1 if arg[0].endswith('...]'): self.unlimited_args = True args += arg[0] + " " pad = (maxlen - len(arg[0])) * ' ' + ' ' usage += "\n " + arg[0] + pad + arg[1] usage = usage.replace('ARGS', args) OptionParser.__init__(self, usage)
def __init__(self): OptionParser.__init__(self) self.add_option('--TargetIp', help='IP Address of Target Machine', dest="TargetIp") self.add_option('--TargetPort', help='Port of Target Machine', dest="TargetPort", default=445, type='int') self.add_option('--NetworkTimeout', help='Timeout for networking calls', dest="NetworkTimeout", default=60, type='int') self.add_option('--TargetEPMPort', help='Port of Target Machine', dest="TargetEPMPort", default=135, type='int') self.add_option('--CredentialType', help='Type of credential provided', dest="CredentialType", default="UsernamePassword") self.add_option('--Username', help='Account Username', dest="Username") self.add_option('--Credential', help='Account Password', dest="Credential") self.add_option('--Domain', help='Account Domain', dest="Domain", default=None) # Kerberos options self.add_option("--UseESRO", action="store_true", dest="UseESRO") self.add_option('--KerbCredentialType', help="The type of credential to use when performing the kerberos authentication", dest='KerbCredentialType') self.add_option('--TargetNetbiosName', help="NETBIOS name of the target computer", dest='TargetNetbiosName') self.add_option('--TargetDcIp', help="Domain Controller's IP address", dest='TargetDcIp') self.add_option('--TargetDcKerberosPort', help="Port used by the Kerberos service", dest='TargetDcKerberosPort', default=88, type='int') self.add_option('--TargetDcSMBPort', help="Port used by the Kerberos service", dest='TargetDcSMBPort', default=445, type='int') # DAPU Options self.add_option('--PrivateKey', help='DAPU Private Key', dest="PrivateKey") # Usability options self.add_option('--TabCompletion', help='Disable tab completion, which uses more network traffic, and may be painful over slow networks', dest="TabCompletion")
def __init__(self, usage=None, version=None): """ Initialize all options possibles. """ OptionParser.__init__(self, usage=usage, version=version, option_list=[ Option("-c", "--slapos_configuration", help="The path of the slapos configuration directory", default='/etc/slapos/', type=str), Option("-o", "--hostname_path", help="The hostname configuration path", default='/etc/HOSTNAME', type=str), Option("-s", "--host_path", help="The hosts configuration path", default='/etc/hosts', type=str), Option("-n", "--dry_run", help="Simulate the execution steps", default=False, action="store_true"), Option(None, "--no_usb", default=False, action="store_true", help="Do not write on USB."), Option(None, "--one_disk",default=False, action="store_true", help="Prepare image for one disk usage"), Option(None, "--virtual",default=False, action="store_true", help="Work with .vmdk files") ])
def __init__(self): OptionParser.__init__(self) self.add_option("-t", "--jenkins-type", action="store", dest="jenkins_type", default="selenium", help="Type of server to generate.") self.add_option("-j", "--jenkins-jobset", dest="jenkins_jobset", default="integration", help="Specific host this Jenkins will be deployed to.") self.add_option("-o", "--install-dir", dest="install_dir", default="/ebs/ci-build/tools/jenkins", help="Location to install the newly generated server.") self.add_option("-b", "--jenkins-branch", dest="jenkins_branch", default="release", help="Branch to use in testing.") self.add_option("-e", "--recipient-email", dest="recipient_email", default=" ", help="Email recipient") self.add_option("-d", "--discard-old-builds", action="store_true", dest="discard_old_builds", default=False, help="If set, old builds will be discarded.")
def __init__(self, command, prefix='', usage=None, sections=[]): """ @param command: the command to build the config parser for @type command: C{str} @param prefix: A prefix to add to all command line options @type prefix: C{str} @param usage: a usage description @type usage: C{str} @param sections: additional (non optional) config file sections to parse @type sections: C{list} of C{str} """ self.command = command[:-3] if command.endswith('.py') else command self.sections = sections self.prefix = prefix self.config = {} self.valid_options = [] self.config_parser = configparser.SafeConfigParser() self._warned_old_gbp_conf = False try: self.parse_config_files() except configparser.ParsingError as err: raise GbpError(str(err) + "\nSee 'man gbp.conf' for the format.") OptionParser.__init__(self, option_class=GbpOption, prog="gbp %s" % self.command, usage=usage, version='%s %s' % (self.command, gbp_version))
def __init__(self, **kwargs): OptionParser.__init__(self, **kwargs) self.add_option("-m", "--masterMode", action="store_true", dest="masterMode", help="Run the script in master mode.", default=False) self.add_option("--noPrompts", action="store_true", dest="noPrompts", help="Uses default answers (intended for CLOUD TESTS only!).", default=False) self.add_option("--manifestFile", action="store", type="string", dest="manifestFile", help="A JSON file in the form of test_manifest.json (the default).") self.add_option("-b", "--browser", action="store", type="string", dest="browser", help="The path to a single browser (right now, only Firefox is supported).") self.add_option("--browserManifestFile", action="store", type="string", dest="browserManifestFile", help="A JSON file in the form of those found in resources/browser_manifests") self.add_option("--reftest", action="store_true", dest="reftest", help="Automatically start reftest showing comparison test failures, if there are any.", default=False) self.add_option("--port", action="store", dest="port", type="int", help="The port the HTTP server should listen on.", default=8080) self.add_option("--unitTest", action="store_true", dest="unitTest", help="Run the unit tests.", default=False) self.add_option("--fontTest", action="store_true", dest="fontTest", help="Run the font tests.", default=False) self.add_option("--noDownload", action="store_true", dest="noDownload", help="Skips test PDFs downloading.", default=False) self.add_option("--statsFile", action="store", dest="statsFile", type="string", help="The file where to store stats.", default=None) self.add_option("--statsDelay", action="store", dest="statsDelay", type="int", help="The amount of time in milliseconds the browser should wait before starting stats.", default=10000) self.set_usage(USAGE_EXAMPLE)
def __init__(self, *args, **kwargs): OptionParser.__init__(self, *args, **kwargs) self.add_option("-c", "--config", dest="configfile", help="Configuration file.", default="/etc/temboard/temboard.conf")
def __init__(self, usage, version): OptParser.__init__(self, usage=usage, version=version) self.add_option('--config', dest='config', help='Select a location for your config file. If the path is invalid the default locations will be used.') self.add_option('-c', '--canonical', dest='canonical', help='Set the show\'s canonical name to use when performing the online lookup.') self.add_option('--debug', action='store_true', dest='debug', help=SUPPRESS_HELP) self.add_option('--deluge', action='store_true', dest='deluge', help='Checks Deluge to make sure the file has been completed before renaming.') self.add_option('--deluge-ratio', dest='deluge_ratio', help='Checks Deluge for completed and that the file has at least reached X share ratio.') self.add_option('-d', '--dry-run', dest='dry', action='store_true', help='Dry run your renaming.') self.add_option('-e', '--episode', dest='episode', help='Set the episode number. Currently this will cause errors when working with more than one file.') self.add_option('--ignore-filelist', dest='ignore_filelist', help=SUPPRESS_HELP) self.add_option('--ignore-recursive', action='store_true', dest='ignore_recursive', help='Only use files from the root of a given directory, not entering any sub-directories.') self.add_option('--log-file', dest='log_file', help='Set the log file location.') self.add_option('-l', '--log-level', dest='log_level', help='Set the log level. Options: short, minimal, info and debug.') self.add_option('--library', dest='library', default='thetvdb', help='Set the library to use for retrieving episode titles. Options: thetvdb & tvrage.') self.add_option('-n', '--name', dest='name', help='Set the episode\'s name.') self.add_option('-o', '--output', dest='output_format', help='Set the output format for the episodes being renamed.') self.add_option('--organise', action='store_true', dest='organise', help='Organise renamed files into folders based on their show name and season number.') self.add_option('--no-organise', action='store_false', dest='organise', help='Explicitly tell Tv Renamr not to organise renamed files. Used to override the config.') self.add_option('-q', '--quiet', action='store_true', dest='quiet', help='Don\'t output logs to the command line') self.add_option('-r', '--recursive', action='store_true', dest='recursive', help='Recursively lookup files in a given directory') self.add_option('--rename-dir', dest='rename_dir', help='The directory to move renamed files to, if not specified the working directory is used.') self.add_option('--no-rename-dir', action='store_false', dest='rename_dir', help='Explicity tell Tv Renamr not to move renamed files. Used to override the config.') self.add_option('--regex', dest='regex', help='The regular expression to use when extracting information from files.') self.add_option('-s', '--season', dest='season', help='Set the season number.') self.add_option('--show', dest='show', help='Set the show\'s name (will search for this name).') self.add_option('--show-override', dest='show_override', help='Override the show\'s name (only replaces the show\'s name in the final file)') self.add_option('-t', '--the', action='store_true', dest='the', help='Set the position of \'The\' in a show\'s name to the end of the show name') def parse_args(self): return OptParser.parse_args(self)
def __init__(self, *args, **kwargs): self.groups = {} if 'formatter' not in kwargs: kwargs['formatter'] = IndentedGroupingOptionHelpFormatter() OptionParser.__init__(self, *args, **kwargs)
def __init__(self): OptionParser.__init__(self) self.add_option("--utility-path", action="store", type="string", dest="utility_path", default=None, help="absolute path to directory containing utility programs") self.add_option("--symbols-path", action="store", type="string", dest="symbols_path", default=None, help="absolute path to directory containing breakpad symbols, \ or the URL of a zip file containing symbols") self.add_option("--appname", action="store", type="string", dest="app", default="org.mozilla.geckoview_example", help="geckoview_example package name") self.add_option("--deviceIP", action="store", type="string", dest="deviceIP", default=None, help="ip address of remote device to test") self.add_option("--deviceSerial", action="store", type="string", dest="deviceSerial", default=None, help="serial ID of remote device to test") self.add_option("--adbpath", action="store", type="string", dest="adbPath", default="adb", help="Path to adb binary.") self.add_option("--remoteTestRoot", action="store", type="string", dest="remoteTestRoot", default=None, help="remote directory to use as test root \ (eg. /mnt/sdcard/tests or /data/local/tests)")
def __init__(self,*args,**kwargs): if 'option_class' in kwargs: if not issubclass(kwargs['option_class'],self._option): raise Exception("option_class must be a subclass of %s"%self._option.__name__) else: kwargs['option_class'] = self._option OptionParser.__init__(self,*args,**kwargs)
def __init__(self): OptionParser.__init__(self) self.add_option("-u", "--upload", action="store_true", dest="upload", default=False, metavar='OPTION', help="If the tag is present, upload the compiled " "file over the first JTAG cable found.") self.add_option("-c", "--clear", action="store_true", dest="clear", default=False, metavar='OPTION', help="If the tag is present, any existing generated " "files will be cleared.") self.add_option("-t", "--time", action="store_true", dest="time", default=False, metavar='OPTION', help="If the tag is present, report the elapsed time " "will be measured and reported.") self.add_option("--parallel", action="store", dest="parallel", default=1, metavar='NUM_PROCESSORS', help="Number of parallel processes. More than 1 " "requires license.") self.add_option("-p", "--project", action="store", dest="project", default=None, metavar='FOLDERNAME', help="The foldername of the project. By default, " "the project entrypoint verilog file is assumed " "to be the same as the foldername.") self.add_option("-d", "--device", action="store", dest="device_name", default="EP4CE22F17C6", metavar='CHIP', help="The name of the target device.") self.add_option("-e", "--eeprom", action="store", dest="eeprom_name", default="EPCS64", metavar='CHIP', help="The name of the eeprom chip where the image " "will be loaded.")
def __init__(self, *ar, **kwar): """ just a wrapper for inherited __init__ except keyword arguments 'filefirst', 'short_option' and 'long_option' """ #the short name for load-from-file option, default -f if 'short_option' in kwar: self.short_option = kwar['short_option'] kwar.pop('short_option') else: self.short_option = '-f' #the long name for load-from-file option, default --from-file if 'long_option' in kwar: self.long_option = kwar['long_option'] kwar.pop('long_option') else: self.long_option = '--from-file' #the filefirst property indicates if the options text file #should be processed before command line options, #allowing command ling options to override them #arguments list is always extended if 'filefirst' in kwar: self.filefirst = kwar['filefirst'] kwar.pop('filefirst') else: self.filefirst = False OptionParser.__init__(self, *ar, **kwar) self.add_option(self.short_option, self.long_option, action="store", dest="optionsfromfile", help="Loads options from file", default =None)
def __init__(self): usage = 'tvr [options] <file/folder>' version = 'Tv Renamr {0}'.format(__version__) OptParser.__init__(self, usage=usage, version=version) self.add_option('--config', dest='config', help='Select a location for your config file. If the path is invalid the default locations will be used.') self.add_option('-c', '--canonical', dest='canonical', help='Set the show\'s canonical name to use when performing the online lookup.') self.add_option('--debug', action='store_true', dest='debug', help=SUPPRESS_HELP) self.add_option('-d', '--dry-run', dest='dry', action='store_true', help='Dry run your renaming.') self.add_option('-e', '--episode', dest='episode', help='Set the episode number. Currently this will cause errors when working with more than one file.') self.add_option('--history', action='store_true', dest='history', help='Display a list of shows renamed using the system pager.') self.add_option('--ignore-filelist', dest='ignore_filelist', default=(), help=SUPPRESS_HELP) self.add_option('--ignore-recursive', action='store_true', dest='ignore_recursive', help='Only use files from the root of a given directory, not entering any sub-directories.') self.add_option('--log-file', dest='log_file', help='Set the log file location.') self.add_option('-l', '--log-level', dest='log_level', help='Set the log level. Options: short, minimal, info and debug.') self.add_option('--library', dest='library', default='thetvdb', help='Set the library to use for retrieving episode titles. Options: thetvdb & tvrage.') self.add_option('-n', '--name', dest='name', help='Set the episode\'s name.') self.add_option('--no-cache', action='store_true', dest='cache', help='Force all renames to ignore the cache.') self.add_option('-o', '--output', dest='output_format', help='Set the output format for the episodes being renamed.') self.add_option('--organise', action='store_true', dest='organise', help='Organise renamed files into folders based on their show name and season number.') self.add_option('--no-organise', action='store_false', dest='organise', help='Explicitly tell Tv Renamr not to organise renamed files. Used to override the config.') self.add_option('-p', '--partial', action='store_true', dest='partial', help='Allow partial regex matching of the filename.') self.add_option('-q', '--quiet', action='store_true', dest='quiet', help='Don\'t output logs to the command line') self.add_option('-r', '--recursive', action='store_true', dest='recursive', default=False, help='Recursively lookup files in a given directory') self.add_option('--rename-dir', dest='rename_dir', help='The directory to move renamed files to, if not specified the working directory is used.') self.add_option('--no-rename-dir', action='store_false', dest='rename_dir', help='Explicity tell Tv Renamr not to move renamed files. Used to override the config.') self.add_option('--regex', dest='regex', help='The regular expression to use when extracting information from files.') self.add_option('-s', '--season', dest='season', help='Set the season number.') self.add_option('--show', dest='show_name', help='Set the show\'s name (will search for this name).') self.add_option('--show-override', dest='show_override', help='Override the show\'s name (only replaces the show\'s name in the final file)') self.add_option('--specials', dest='specials_folder', help='Set the show\'s specials folder (defaults to "Season 0")') self.add_option('-t', '--the', action='store_true', dest='the', help='Set the position of \'The\' in a show\'s name to the end of the show name')
def __init__(self,file): OptionParser.__init__(self) #Network self.add_option("-H","--host",help="Specify a hostname to which to send a remote notification. [%default]", dest="host",default='localhost') self.add_option("--port",help="port to listen on", dest="port",type="int",default=23053) self.add_option("-P","--password",help="Network password", dest='password',default='') #Required (Needs Defaults) self.add_option("-n","--name",help="Set the name of the application [%default]", dest="app",default='Python GNTP Test Client') self.add_option("-N","--notification",help="Set the notification name [%default]", dest="name",default='Notification') self.add_option("-t","--title",help="Set the title of the notification [Default :%default]", dest="title",default=None) self.add_option("-m","--message",help="Sets the message instead of using stdin", dest="message",default=None) #Optional (Does not require Default) self.add_option("-d","--debug",help="Print raw growl packets", dest='debug',action="store_true",default=False) self.add_option("-s","--sticky",help="Make the notification sticky [%default]", dest='sticky',action="store_true",default=False) self.add_option("-p","--priority",help="-2 to 2 [%default]", dest="priority",type="int",default=0) self.add_option("--image",help="Icon for notification (Only supports URL currently)", dest="icon",default='') self.add_option("-e","--edit",help="Open config in $EDITOR", dest='edit',action="store_true",default=False)
def __init__(self): """Process command line arguments and call runTests() to do the real work.""" OptionParser.__init__(self) addCommonOptions(self) self.add_option("--interactive", action="store_true", dest="interactive", default=False, help="don't automatically run tests, drop to an xpcshell prompt") self.add_option("--verbose", action="store_true", dest="verbose", default=False, help="always print stdout and stderr from tests") self.add_option("--keep-going", action="store_true", dest="keepGoing", default=False, help="continue running tests after test killed with control-C (SIGINT)") self.add_option("--logfiles", action="store_true", dest="logfiles", default=True, help="create log files (default, only used to override --no-logfiles)") self.add_option("--manifest", type="string", dest="manifest", default=None, help="Manifest of test directories to use") self.add_option("--no-logfiles", action="store_false", dest="logfiles", help="don't create log files") self.add_option("--test-path", type="string", dest="testPath", default=None, help="single path and/or test filename to test") self.add_option("--total-chunks", type = "int", dest = "totalChunks", default=1, help = "how many chunks to split the tests up into") self.add_option("--this-chunk", type = "int", dest = "thisChunk", default=1, help = "which chunk to run between 1 and --total-chunks") self.add_option("--profile-name", type = "string", dest="profileName", default=None, help="name of application profile being tested")
def __init__(self): OptionParser.__init__(self) self.add_option( "--xre-path", action="store", type="string", dest="xre_path", default=None, help= "absolute path to directory containing XRE (probably xulrunner)") self.add_option( "--symbols-path", action="store", type="string", dest="symbols_path", default=None, help= "absolute path to directory containing breakpad symbols, or the URL of a zip file containing symbols" ) self.add_option( "--manifest-path", action="store", type="string", dest="manifest_path", default=None, help= "path to test manifest, if different from the path to test binaries" )
def __init__(self, *args, **kwargs): if not kwargs.has_key("usage"): kwargs["usage"] = "%prog [options] <command> [command options]" OptionParser.__init__(self, *args, **kwargs) self.auto_order = kwargs.pop('auto_order', False) self.commands = [] self.groups = {}
def __init__(self, *args, **kwargs): if not kwargs.has_key("usage"): kwargs["usage"] = "%prog [options] <command> [command options]" OptionParser.__init__(self, *args, **kwargs) self.commands = [] self.groups = {}
def __init__(self,*args,**kwargs): if kwargs.has_key('option_class'): if not issubclass(kwargs['option_class'],self._option): raise Exception, "option_class must be a subclass of %s"%self._option.__name__ else: kwargs['option_class'] = self._option OptionParser.__init__(self,*args,**kwargs)
def __init__(self, func, help): OptionParser.__init__(self) self.formatter = Formatter() self.func = func self.help = help self.usage = getattr(help, "usage", None) self.description = help.__doc__ runner = self._runner(func) args, varargs, varkw, defaults = inspect.getargspec(runner) defaults = defaults or () # Account for the self argument if isinstance(runner, self.METHOD_TYPES): args = args[1:] # Check that we know about everything for arg in args: if arg in self.help: continue raise RuntimeError("Unknown argument: %r" % arg) self.required = args[:len(args) - len(defaults)] for name, value in zip(args[len(args) - len(defaults):], defaults): opt = help[name].as_opt(value) self.add_option(opt)
def __init__(self): usage = 'tvr [options] <file/folder>' version = 'Tv Renamr {0}'.format(__version__) OptParser.__init__(self, usage=usage, version=version) self.add_option('--config', dest='config', help='Select a location for your config file. If the path is invalid the default locations will be used.') self.add_option('-c', '--canonical', dest='canonical', help='Set the show\'s canonical name to use when performing the online lookup.') self.add_option('--debug', action='store_true', dest='debug', help=SUPPRESS_HELP) self.add_option('-d', '--dry-run', dest='dry', action='store_true', help='Dry run your renaming.') self.add_option('-e', '--episode', dest='episode', help='Set the episode number. Currently this will cause errors when working with more than one file.') self.add_option('--ignore-filelist', dest='ignore_filelist', default=(), help=SUPPRESS_HELP) self.add_option('--ignore-recursive', action='store_true', dest='ignore_recursive', help='Only use files from the root of a given directory, not entering any sub-directories.') self.add_option('--log-file', dest='log_file', help='Set the log file location.') self.add_option('-l', '--log-level', dest='log_level', help='Set the log level. Options: short, minimal, info and debug.') self.add_option('--library', dest='library', default='thetvdb', help='Set the library to use for retrieving episode titles. Options: thetvdb & tvrage.') self.add_option('-n', '--name', dest='name', help='Set the episode\'s name.') self.add_option('--no-cache', action='store_true', dest='cache', help='Force all renames to ignore the cache.') self.add_option('-o', '--output', dest='output_format', help='Set the output format for the episodes being renamed.') self.add_option('--organise', action='store_true', dest='organise', help='Organise renamed files into folders based on their show name and season number.') self.add_option('--no-organise', action='store_false', dest='organise', help='Explicitly tell Tv Renamr not to organise renamed files. Used to override the config.') self.add_option('-p', '--partial', action='store_true', dest='partial', help='Allow partial regex matching of the filename.') self.add_option('-q', '--quiet', action='store_true', dest='quiet', help='Don\'t output logs to the command line') self.add_option('-r', '--recursive', action='store_true', dest='recursive', default=False, help='Recursively lookup files in a given directory') self.add_option('--rename-dir', dest='rename_dir', help='The directory to move renamed files to, if not specified the working directory is used.') self.add_option('--no-rename-dir', action='store_false', dest='rename_dir', help='Explicity tell Tv Renamr not to move renamed files. Used to override the config.') self.add_option('--regex', dest='regex', help='The regular expression to use when extracting information from files.') self.add_option('-s', '--season', dest='season', help='Set the season number.') self.add_option('--show', dest='show_name', help='Set the show\'s name (will search for this name).') self.add_option('--show-override', dest='show_override', help='Override the show\'s name (only replaces the show\'s name in the final file)') self.add_option('--specials', dest='specials_folder', help='Set the show\'s specials folder (defaults to "Season 0")') self.add_option('-t', '--the', action='store_true', dest='the', help='Set the position of \'The\' in a show\'s name to the end of the show name')
def __init__(self, **args): OptionParser.format_epilog = lambda self, formatter: self.epilog OptionParser.__init__(self, **args) self.__setup_standard_options() # Automatically initialized if any plugin addds an option # to the OptionParser. self.__plugin_grp = None
def __init__(self, version): self.__command_name = os.path.basename(sys.argv[0]) OptionParser.__init__(self, option_class=ExtendOption, version="%s %s\n" % (self.__command_name, version), description="%s \n" % (self.__command_name))
def __init__(self, usage): OptionParser.__init__(self, usage) self.add_option("-e", "--engine", type="choice", choices=("x11", "x11-16"), default="x11-16", help=("which display engine to use (x11, x11-16), " "default=%default")) self.add_option("-n", "--no-fullscreen", action="store_true", help="do not launch in fullscreen") self.add_option("-g", "--geometry", type="string", metavar="WxH", action="callback", callback=self.parse_geometry, default=(WIDTH, HEIGHT), help="use given window geometry") self.add_option("-f", "--fps", type="int", default=20, help="frames per second to use, default=%default")
def __init__(self, schema_file=None): OptionParser.__init__(self, usage='usage: %prog [options] TXTFILES...') self.add_option('--a1-dir', action='store', type='string', dest='a1_dir', help='name of the directory containing .a1 files') self.add_option( '--a2-dir', action='store', type='string', dest='a2_dir', help='name of the directory containing reference .a2 files') self.add_option( '--silence', action='store', type='string', dest='ignore', help= 'if this option is given, then the schema error messages that match exactly one of the specified lines will be silenced' ) self.schema_file = schema_file if not schema_file: self.add_option( '--schema', action='store', type='string', dest='schema', help='annotations will be checked against the specified schema' )
def __init__(self, *args, **kwargs): self.parent_parser = kwargs['parent_parser'] del kwargs['parent_parser'] kwargs['add_help_option'] = False OptionParser.__init__(self, *args, **kwargs)
def __init__(self): OptionParser.__init__(self, usage=self.usage, description=self.description) self.add_option('-d', '--debug', action='store_true', help='enable debugging') self.add_option('-v', '--verbose', action='store_true', help='be more verbose') self.add_option('-H', '--help-commands', action='store_true', help='show help on commands') self.add_option('-U', '--url', help='specifies the API entry point URL') self.add_option('-u', '--username', help='connect as this user') self.add_option('-p', '--password', help='specify password') self.add_option('-r', '--read-input', action='store_true', help='read pre-formatted input on stdin') self.add_option('-i', '--input-format', metavar='FORMAT', help='input format for pre-formatted input') self.add_option('-o', '--output-format', metavar='FORMAT', help='specfies the output format') self.add_option('-c', '--connect', action='store_true', help='automatically connect') self.add_option('-f', '--filter', metavar='FILE', help='read commands from FILE instead of stdin') self.add_option('-w', '--wide', action='store_true', help='wide display') self.add_option('-n', '--no-header', action='store_false', dest='header', help='suppress output header') self.add_option('-F', '--fields', help='fields to display') self.disable_interspersed_args()
def __init__(self, func, help): OptionParser.__init__(self) self.formatter = Formatter() self.func = func self.help = help self.usage = getattr(help, "usage", None) self.description = help.__doc__ runner = self._runner(func) args, varargs, varkw, defaults = inspect.getargspec(runner) defaults = defaults or () # Account for the self argument if isinstance(runner, self.METHOD_TYPES): args = args[1:] # Check that we know about everything for arg in args: if arg in self.help: continue raise RuntimeError("Unknown argument: %r" % arg) self.required = args[:len(args)-len(defaults)] for name, value in zip(args[len(args)-len(defaults):], defaults): opt = help[name].as_opt(value) self.add_option(opt)
def __init__(self): OptionParser.__init__(self) #Network self.add_option("-H", "--host", help="Specify a hostname to which to send a remote notification. [%default]", dest="host", default='localhost') self.add_option("--port", help="port to listen on", dest="port", type="int", default=23053) self.add_option("-P", "--password", help="Network password", dest='password', default='') #Required (Needs Defaults) self.add_option("-n", "--name", help="Set the name of the application [%default]", dest="app", default='Python GNTP Test Client') self.add_option("-N", "--notification", help="Set the notification name [%default]", dest="name", default='Notification') self.add_option("-t", "--title", help="Set the title of the notification [Default :%default]", dest="title", default=None) self.add_option("-m", "--message", help="Sets the message instead of using stdin", dest="message", default=None) #Optional (Does not require Default) self.add_option('-v', '--verbose', help="Verbosity levels", dest='verbose', action='count', default=0) self.add_option("-s", "--sticky", help="Make the notification sticky [%default]", dest='sticky', action="store_true", default=False) self.add_option("-p", "--priority", help="-2 to 2 [%default]", dest="priority", type="int", default=0) self.add_option("--image", help="Icon for notification (Only supports URL currently)", dest="icon", default=None) self.add_option("--callback", help="URL callback", dest="callback")
def __init__(self, **kwargs): OptionParser.__init__(self) defaults = {} self.add_option('--tree', action="store", type='string', dest='tree', help = 'Comma separated list of trees to watch for pulling builds, default mozilla-central') defaults['tree'] = 'mozilla-central' self.add_option('--platforms', action="store", type = "string", dest='platforms', help = "Comma separated list of platforms to pull builds for - defaults to all with blank spec") self.add_option('--buildtype', action="store", type="string", dest="buildtype", help = "Either opt,dbg build to pull from, defaults to all with blank spec") self.add_option('--testlist', action='store', type='string', dest='testlist', help="Comma separated list of test types to harvest logs for, defaults to all with blank spec") self.add_option('--strip-non-talos', action='store_true', dest='strip_non_talos', help="Flag to drop non-talos tests, defaults to false, should not be used with --strip-talos") defaults['strip_non_talos'] = False self.add_option('--strip-talos', action='store_true', dest='strip_talos', help="Flag to drop talos tests, defaults to false, should not be used with --strip-non-talos") defaults['strip_talos'] = False self.add_option('--dump', action='store_true', dest='dump', help="Flag to pull logs and dump to stdin - will unzip the file - defaults to flase") self.add_option('--log-destination', action='store', type = 'string', dest='log_dest', help="Location to store downloaded logs - defaults to ./logs/") defaults['log_dest'] = "./logs/" self.set_defaults(**defaults)
def __init__(self,file): OptionParser.__init__(self) self._config = ServerConfig(file) # Network Options self.add_option("-a","--address",help="address to listen on", dest="host",default=self._config['server.address']) self.add_option("-p","--port",help="port to listen on", dest="port",type="int",default=self._config['server.port']) self.add_option("-P","--password",help="Network password", dest='password',default=self._config['server.password']) # Misc Options self.add_option("-r","--regrowl",help="ReGrowl on local OSX machine", dest='regrowl',action="store_true",default=self._config['server.regrowl']) self.add_option("-e","--edit",help="Open config in $EDITOR", dest='edit',action="store_true",default=False) self.add_option("-s","--sticky",help="Make the notification sticky [%default]", dest='sticky',action="store_true",default=False) # Debug Options self.add_option("-d","--debug",help="Print raw growl packets", dest='debug',action="store_true",default=self._config['server.debug']) self.add_option("-q","--quiet",help="Quiet mode", dest='debug',action="store_false")
def __init__(self): OptionParser.__init__(self, 'usage: %prog [options]') self.add_option( '-r', '--repo', dest='repo', help='The remote repository from which to pull the main source') self.add_option('-c', '--cache', dest='cache', help='A local cache of the remote repositories') self.add_option( '-l', '--l10n-base-repo', dest='l10nbase', help= 'The base directory of the remote repositories to pull l10n data from' ) self.add_option('-t', '--tag', dest='tag', help='Release tag to base the checkout on') self.add_option('-n', '--name', dest='name', help='The package name') self.add_option('-a', '--application', dest='application', help='The application to build') self.add_option('-m', '--mozdir', dest='mozdir', help='The location of the Mozilla source', default='')
def __init__(self, **kwargs): # Do this early, so even option processing stuff is caught if '--bugreport' in sys.argv: self._debug_tb_callback() OptParser.__init__(self, **kwargs) self.version = flexget.__version__ self.add_option('-V', '--version', action='version', help='Print FlexGet version and exit.') self.add_option('--bugreport', action='callback', callback=self._debug_tb_callback, dest='debug_tb', help="Use this option to create a detailed bug report," " note that the output might contain PRIVATE data, so edit that out") self.add_option('--logfile', action='store', dest='logfile', default='flexget.log', help='Specify a custom logfile name/location. Default is flexget.log in the config directory.') self.add_option('--debug', action='callback', callback=self._debug_callback, dest='debug', help=SUPPRESS_HELP) self.add_option('--debug-trace', action='callback', callback=self._debug_callback, dest='debug_trace', help=SUPPRESS_HELP) self.add_option('--loglevel', action='store', type='choice', default='verbose', dest='loglevel', choices=['none', 'critical', 'error', 'warning', 'info', 'verbose', 'debug', 'trace'], help=SUPPRESS_HELP) self.add_option('--debug-sql', action='store_true', dest='debug_sql', default=False, help=SUPPRESS_HELP) self.add_option('-c', action='store', dest='config', default='config.yml', help='Specify configuration file. Default is config.yml') self.add_option('--experimental', action='store_true', dest='experimental', default=False, help=SUPPRESS_HELP) self.add_option('--del-db', action='store_true', dest='del_db', default=False, help=SUPPRESS_HELP) self.add_option('--profile', action='store_true', dest='profile', default=False, help=SUPPRESS_HELP)
def __init__(self, **args): """ See documentation of optparse.OptionParser for arguments. """ class MyIndentedHelpFormatter(IndentedHelpFormatter): """ Slightly modified formatter for help output: allow paragraphs """ def format_paragraphs(self, text): """ wrap text per paragraph """ result = "" for paragraph in text.split("\n"): result += self._format_text(paragraph) + "\n" return result def format_description(self, description): """ format description, honoring paragraphs """ if description: return self.format_paragraphs(description) + "\n" else: return "" def format_epilog(self, epilog): """ format epilog, honoring paragraphs """ if epilog: return "\n" + self.format_paragraphs(epilog) + "\n" else: return "" OptionParser.__init__(self, **args) self.add_option("-p", "--profile", dest="profile", help="Use FILE as the MailboxFactory config file " "defining all the mailboxes for this program.", metavar="FILE") if not args.has_key('formatter'): self.formatter = MyIndentedHelpFormatter() if os.environ.has_key('PROC_IMAP_PROFILE'): self.set_defaults(profile=os.environ['PROC_IMAP_PROFILE'])
def __init__(self, **kwargs): # a bit awkward, but in place as a sort of memoizing if "formatter" not in kwargs: kwargs["formatter"] = self.formatter_nonexpert OptionParser.__init__(self, **kwargs) self.formatter_expert.set_parser(self) # ensure %default expansion self.description_raw = ""
def __init__(self, usage=''): OptionParser.__init__(self, add_help_option=False, usage=usage) self.add_option('-h', '--help', action='store_true', help='Display this help message.')
def __init__(self, **kwargs): OptionParser.__init__(self, **kwargs) self.add_option("-b", "--browser", action="store", type="string", dest="browser", help="The path to a single browser (right now, only Firefox is supported).") self.add_option("--port", action="store", dest="port", type="int", help="The port the HTTP server should listen on.", default=8087) self.set_usage(USAGE_EXAMPLE)
def __init__(self): OptionParser.__init__(self) self.add_option( "--cwd", dest="cwd", default=os.getcwd(), help="absolute path to directory from which to run the binary") self.add_option( "--xre-path", dest="xre_path", default=None, help= "absolute path to directory containing XRE (probably xulrunner)") self.add_option( "--symbols-path", dest="symbols_path", default=None, help= "absolute path to directory containing breakpad symbols, or the URL of a zip file containing symbols" ) self.add_option( "--utility-path", dest="utility_path", default=None, help="path to a directory containing utility program binaries")
def __init__(self, **kwargs): OptionParser.__init__(self, **kwargs) self.add_option('--dz-url', action='store', dest='datazilla_url', default='https://datazilla.mozilla.org', metavar='str', help='datazilla server url (default: %default)') self.add_option('--dz-project', action='store', dest='datazilla_project', metavar='str', help='datazilla project name') self.add_option('--dz-branch', action='store', dest='datazilla_branch', metavar='str', help='datazilla branch name') self.add_option('--dz-key', action='store', dest='datazilla_key', metavar='str', help='oauth key for datazilla server') self.add_option('--dz-secret', action='store', dest='datazilla_secret', metavar='str', help='oauth secret for datazilla server') self.add_option('--sources', action='store', dest='sources', metavar='str', help='path to sources.xml containing project revisions')
def __init__(self, *args, **kwargs): OptionParser.__init__(self, *args, **kwargs) def increase_verbosity(option, opt, value, parser): parser.values.verbosity -= 1 def debug_sql(option, opt, value, parser): import mdb mdb.cursor.debug = True self.add_option('', '--root', help='root directory') self.add_option('', '--verbosity', help='set absolute verbosity', default=INFORMATION) self.add_option('-v', '', help='increase verbosity', action='callback', callback=increase_verbosity) self.add_option('-d', '--debug', help='debug sql', action='callback', callback=debug_sql)