本文整理汇总了Python中optparse.make_option方法的典型用法代码示例。如果您正苦于以下问题:Python optparse.make_option方法的具体用法?Python optparse.make_option怎么用?Python optparse.make_option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类optparse
的用法示例。
在下文中一共展示了optparse.make_option方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_opts
# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import make_option [as 别名]
def add_opts(self, optparser):
optlist = [
optparse.make_option('--jsonschema-debug',
dest='schema_debug',
action="store_true",
help='JSON Schema debug'),
optparse.make_option('--jsonschema-path',
dest='schema_path',
help='JSON Schema path'),
optparse.make_option('--jsonschema-title',
dest='schema_title',
help='JSON Schema title'),
]
group = optparser.add_option_group("JSON Schema-specific options")
group.add_options(optlist)
示例2: add_opts
# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import make_option [as 别名]
def add_opts(self, optparser):
optlist = [
optparse.make_option("--yang-canonical",
dest="yang_canonical",
action="store_true",
help="Print in canonical order"),
optparse.make_option("--yang-remove-unused-imports",
dest="yang_remove_unused_imports",
action="store_true"),
optparse.make_option("--yang-remove-comments",
dest="yang_remove_comments",
action="store_true"),
optparse.make_option("--yang-line-length",
type="int",
dest="yang_line_length",
help="Maximum line length"),
]
g = optparser.add_option_group("YANG output specific options")
g.add_options(optlist)
示例3: add_opts
# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import make_option [as 别名]
def add_opts(self, optparser):
optlist = [
optparse.make_option("--sample-xml-skeleton-doctype",
dest="doctype",
default="data",
help="Type of sample XML document " +
"(data or config)."),
optparse.make_option("--sample-xml-skeleton-defaults",
action="store_true",
dest="sample_defaults",
default=False,
help="Insert leafs with defaults values."),
optparse.make_option("--sample-xml-skeleton-annotations",
action="store_true",
dest="sample_annots",
default=False,
help="Add annotations as XML comments."),
optparse.make_option("--sample-xml-skeleton-path",
dest="sample_path",
help="Subtree to print"),
]
g = optparser.add_option_group(
"Sample-xml-skeleton output specific options")
g.add_options(optlist)
示例4: add_opts
# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import make_option [as 别名]
def add_opts(self, optparser):
optlist = [
optparse.make_option("--lint",
dest="lint",
action="store_true",
help="Validate the module(s) according to " \
"RFC 8407rules."),
optparse.make_option("--lint-namespace-prefix",
dest="lint_namespace_prefixes",
default=[],
action="append",
help="Validate that the module's namespace " \
"matches one of the given prefixes."),
optparse.make_option("--lint-modulename-prefix",
dest="lint_modulename_prefixes",
default=[],
action="append",
help="Validate that the module's name " \
"matches one of the given prefixes."),
optparse.make_option("--lint-ensure-hyphenated-names",
dest="lint_ensure_hyphenated_names",
action="store_true",
help="No upper case and underscore in names."),
]
optparser.add_options(optlist)
示例5: __init__
# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import make_option [as 别名]
def __init__(self):
P4Sync.__init__(self)
self.description = "Creates a new git repository and imports from Perforce into it"
self.usage = "usage: %prog [options] //depot/path[@revRange]"
self.options += [
optparse.make_option("--destination", dest="cloneDestination",
action='store', default=None,
help="where to leave result of the clone"),
optparse.make_option("-/", dest="cloneExclude",
action="append", type="string",
help="exclude depot path"),
optparse.make_option("--bare", dest="cloneBare",
action="store_true", default=False),
]
self.cloneDestination = None
self.needsGit = False
self.cloneBare = False
# This is required for the "append" cloneExclude action
示例6: add_opts
# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import make_option [as 别名]
def add_opts(self, optparser):
optlist = [
optparse.make_option("--pyimport-help",
dest="pyimport_help",
action="store_true",
help="Print help on PyImport and exit"),
]
g = optparser.add_option_group("PyImport output specific options")
g.add_options(optlist)
示例7: add_opts
# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import make_option [as 别名]
def add_opts(self, optparser):
optlist = [
optparse.make_option("--cxml-help",
dest="cxml_help",
action="store_true",
help="Print help on cxml symbols and exit"),
]
g = optparser.add_option_group("CXML output specific options")
g.add_options(optlist)
示例8: make_options
# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import make_option [as 别名]
def make_options():
opts = [
make_option('--adminmedia', dest='admin_media_path', default='',
help='Specifies the directory from which to serve admin media.')
]
g_settings = make_settings(ignore=("version"))
keys = g_settings.keys()
for k in keys:
if k in ('pythonpath', 'django_settings',):
continue
setting = g_settings[k]
if not setting.cli:
continue
args = tuple(setting.cli)
kwargs = {
"dest": setting.name,
"metavar": setting.meta or None,
"action": setting.action or "store",
"type": setting.type or "string",
"default": None,
"help": "%s [%s]" % (setting.short, setting.default)
}
if kwargs["action"] != "store":
kwargs.pop("type")
opts.append(make_option(*args, **kwargs))
return tuple(opts)
示例9: __init__
# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import make_option [as 别名]
def __init__(self):
super(CommandMixin, self).__init__()
# Optparse was deprecated on 1.8
# So we only define option_list for Django 1.7
if DJANGO_VERSION < (1, 8):
self.option_list = super(CommandMixin, self).option_list + (
optparse.make_option(
'-n',
'--nomigrations',
action='store_true',
dest='nomigrations',
default=False,
help=HELP),
)
示例10: add_opts
# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import make_option [as 别名]
def add_opts(self, optparser):
optlist = [
optparse.make_option("--yin-canonical",
dest="yin_canonical",
action="store_true",
help="Print in canonical order"),
optparse.make_option("--yin-pretty-strings",
dest="yin_pretty_strings",
action="store_true",
help="Pretty print strings"),
]
g = optparser.add_option_group("YIN output specific options")
g.add_options(optlist)
示例11: add_opts
# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import make_option [as 别名]
def add_opts(self, optparser):
optlist = [
optparse.make_option("--dsdl-no-documentation",
dest="dsdl_no_documentation",
action="store_true",
default=False,
help="No output of DTD compatibility"
" documentation annotations"),
optparse.make_option("--dsdl-no-dublin-core",
dest="dsdl_no_dublin_core",
action="store_true",
default=False,
help="No output of Dublin Core"
" metadata annotations"),
optparse.make_option("--dsdl-record-defs",
dest="dsdl_record_defs",
action="store_true",
default=False,
help="Record all top-level defs"
" (even if not used)"),
optparse.make_option("--dsdl-lax-yang-version",
dest="dsdl_lax_yang_version",
action="store_true",
default=False,
help="Try to translate modules with "
"unsupported YANG versions (use at own risk)"),
]
g = optparser.add_option_group("Hybrid DSDL schema "
"output specific options")
g.add_options(optlist)
示例12: add_opts
# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import make_option [as 别名]
def add_opts(self, optparser):
optlist = [
optparse.make_option("--capability-entity",
dest="capa_entity",
action="store_true",
default=False,
help="Write ampersands as XML entity")
]
g = optparser.add_option_group("Capability output specific options")
g.add_options(optlist)
示例13: add_opts
# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import make_option [as 别名]
def add_opts(self, optparser):
optlist = [
optparse.make_option("--sid-help",
dest="sid_help",
action="store_true",
help="Print help on automatic SID generation"),
optparse.make_option("--sid-generate-file",
action="store",
type="string",
dest="generate_sid_file",
help="Generate a .sid file."),
optparse.make_option("--sid-update-file",
action="store",
type="string",
dest="update_sid_file",
help="Generate a .sid file based on a previous .sid file."),
optparse.make_option("--sid-check-file",
action="store",
type="string",
dest="check_sid_file",
help="Check the consistency between a .sid file "
"and the .yang file(s)."),
optparse.make_option("--sid-list",
action="store_true",
dest="list_sid",
help="Print the list of SID."),
optparse.make_option("--sid-registration-info",
action="store_true",
dest="sid_registration_info",
help="Print the information required by the SID registry."),
optparse.make_option("--sid-extra-range",
action="store",
type="string",
dest="extra_sid_range",
help="Add an extra SID range during a .sid file update."),
]
g = optparser.add_option_group("SID file specific options")
g.add_options(optlist)
示例14: add_opts
# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import make_option [as 别名]
def add_opts(self, optparser):
optlist = [
optparse.make_option("--depend-target",
dest="depend_target",
help="Makefile rule target"),
optparse.make_option("--depend-no-submodules",
dest="depend_no_submodules",
action="store_true",
help="Do not generate dependencies for " \
"included submodules"),
optparse.make_option("--depend-from-submodules",
dest="depend_from_submodules",
action="store_true",
help="Generate dependencies from " \
"included submodules"),
optparse.make_option("--depend-recurse",
dest="depend_recurse",
action="store_true",
help="Generate dependencies to all " \
"imports, recursively"),
optparse.make_option("--depend-extension",
dest="depend_extension",
help="YANG module file name extension"),
optparse.make_option("--depend-include-path",
dest="depend_include_path",
action="store_true",
help="Include file path in the prerequisites"),
optparse.make_option("--depend-ignore-module",
dest="depend_ignore",
default=[],
action="append",
help="(sub)module to ignore in the" \
" prerequisites. This option can be" \
" given multiple times."),
]
g = optparser.add_option_group("Depend output specific options")
g.add_options(optlist)
示例15: add_opts
# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import make_option [as 别名]
def add_opts(self, optparser):
optlist = [
optparse.make_option("--mef",
dest="mef",
action="store_true",
help="Validate the module(s) according to " \
"MEF rules."),
]
optparser.add_options(optlist)