本文整理汇总了Python中eit.commands.descriptor.EitCommandDescriptor类的典型用法代码示例。如果您正苦于以下问题:Python EitCommandDescriptor类的具体用法?Python EitCommandDescriptor怎么用?Python EitCommandDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EitCommandDescriptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: bashcomp
def bashcomp(self, last_arg):
"""
Overridden from EitCommand
"""
import sys
descriptors = EitCommandDescriptor.obtain()
descriptors.sort(key = lambda x: x.get_name())
outcome = []
for descriptor in descriptors:
name = descriptor.get_name()
if name == EitHelp.NAME:
# do not add self
continue
outcome.append(name)
aliases = descriptor.get_class().ALIASES
outcome.extend(aliases)
def _startswith(string):
if last_arg is not None:
return string.startswith(last_arg)
return True
outcome = sorted(filter(_startswith, outcome))
sys.stdout.write(" ".join(outcome) + "\n")
sys.stdout.flush()
示例2: _get_parser
def _get_parser(self):
""" Overridden from EitCommand """
descriptor = EitCommandDescriptor.obtain_descriptor(
EitNotice.NAME)
parser = argparse.ArgumentParser(
description=descriptor.get_description(),
formatter_class=argparse.RawDescriptionHelpFormatter,
prog="%s %s" % (sys.argv[0], EitNotice.NAME))
subparsers = parser.add_subparsers(
title="action", description=_("execute given action"),
help=_("available actions"))
add_parser = subparsers.add_parser("add",
help=_("add notice-board entry"))
add_parser.add_argument("repo", nargs='?', default=None,
metavar="<repo>", help=_("repository"))
add_parser.set_defaults(func=self._add)
remove_parser = subparsers.add_parser("remove",
help=_("remove notice-board entry"))
remove_parser.add_argument("repo", nargs='?', default=None,
metavar="<repo>", help=_("repository"))
remove_parser.set_defaults(func=self._remove)
show_parser = subparsers.add_parser("show",
help=_("show notice-board"))
show_parser.add_argument("repo", nargs='?', default=None,
metavar="<repo>", help=_("repository"))
show_parser.set_defaults(func=self._show)
return parser
示例3: _get_parser
def _get_parser(self):
""" Overridden from EitCommand """
descriptor = EitCommandDescriptor.obtain_descriptor(
EitBranch.NAME)
parser = argparse.ArgumentParser(
description=descriptor.get_description(),
formatter_class=argparse.RawDescriptionHelpFormatter,
prog="%s %s" % (sys.argv[0], EitBranch.NAME))
parser.add_argument("--quick", action="store_true",
default=not self._ask,
help=_("no stupid questions"))
parser.add_argument("branch", nargs='?',
metavar="<branch>",
help=_("switch to given branch"))
parser.add_argument("repo", nargs='?',
metavar="<repo>",
help=_("repository"))
parser.add_argument("--from", metavar="<branch>",
help=_("from branch"),
dest="frombranch", default=None)
parser.add_argument("--no-copy", action="store_true",
default=not self._copy, dest="nocopy",
help=_("don't copy packages from branch"))
return parser
示例4: _get_parser
def _get_parser(self):
self._real_command = sys.argv[0]
descriptor = EitCommandDescriptor.obtain_descriptor(
EitPush.NAME)
parser = argparse.ArgumentParser(
description=descriptor.get_description(),
formatter_class=argparse.RawDescriptionHelpFormatter,
prog="%s %s" % (sys.argv[0], EitPush.NAME))
parser.add_argument("repo", nargs='?', default=None,
metavar="<repo>", help=_("repository"))
parser.add_argument("--conservative", action="store_true",
help=_("do not execute implicit package name "
"and slot updates"),
default=self._conservative)
parser.add_argument("--quick", action="store_true",
default=False,
help=_("no stupid questions"))
parser.add_argument("--force", action="store_true",
default=False,
help=_("force push in case of QA errors"))
group = parser.add_mutually_exclusive_group()
group.add_argument("--all", action="store_true",
default=False,
help=_("push all the repositories"))
group.add_argument("--as", metavar="<repo>", default=None,
help=_("push as fake repository"),
dest="asrepo")
parser.add_argument("--pretend", action="store_true",
default=False,
help=_("show what would be done"))
return parser
示例5: _get_parser
def _get_parser(self):
""" Overridden from EitCp """
descriptor = EitCommandDescriptor.obtain_descriptor(
EitCp.NAME)
parser = argparse.ArgumentParser(
description=descriptor.get_description(),
formatter_class=argparse.RawDescriptionHelpFormatter,
prog="%s %s" % (sys.argv[0], EitCp.NAME))
parser.add_argument("source", nargs=1,
metavar="<source>",
help=_("source repository"))
parser.add_argument("dest", nargs=1,
metavar="<dest>",
help=_("destination repository"))
parser.add_argument("--conservative", action="store_true",
help=_("do not execute implicit package name "
"and slot updates"),
default=self._conservative)
parser.add_argument("--deps", action="store_true",
default=False,
help=_("include dependencies"))
parser.add_argument("package", nargs='+', metavar="<package>",
help=_("package dependency"))
return parser
示例6: _get_parser
def _get_parser(self):
""" Overridden from EitCommand """
descriptor = EitCommandDescriptor.obtain_descriptor(
EitRemote.NAME)
parser = argparse.ArgumentParser(
description=descriptor.get_description(),
formatter_class=argparse.RawDescriptionHelpFormatter,
prog="%s %s" % (sys.argv[0], EitRemote.NAME))
subparsers = parser.add_subparsers(
title="action", description=_("execute action"),
help=_("available actions"))
list_parser = subparsers.add_parser("list",
help=_("list repositories"))
list_parser.set_defaults(func=self._list)
add_parser = subparsers.add_parser("add",
help=_("add repository"))
add_parser.add_argument("repository", metavar="<repository>",
help=_("repository id"))
add_parser.add_argument("--desc", metavar="<description>",
default=None,
help=_("repository description"))
add_parser.add_argument("uri", metavar="<uri>", nargs="+",
help=_("repository uri"))
add_parser.set_defaults(func=self._add)
return parser
示例7: _get_parser
def _get_parser(self):
""" Overridden from EitCommand """
descriptor = EitCommandDescriptor.obtain_descriptor(
EitTest.NAME)
parser = argparse.ArgumentParser(
description=descriptor.get_description(),
formatter_class=argparse.RawDescriptionHelpFormatter,
prog="%s %s" % (sys.argv[0], EitTest.NAME))
subparsers = parser.add_subparsers(
title="test", description=_("run given test"),
help=_("available tests"))
deps_parser = subparsers.add_parser("deps",
help=_("dependencies test"))
deps_parser.set_defaults(func=self._deptest)
libs_parser = subparsers.add_parser("libs",
help=_("libraries test"))
libs_parser.add_argument("--dump", action="store_true",
default=False, help=_("dump results to file"))
libs_parser.set_defaults(func=self._libtest)
links_parser = subparsers.add_parser("links",
help=_("library linking test (using repository metadata)"))
links_parser.add_argument("excllibs", nargs='*', default=None,
metavar="<excluded lib>",
help=_("excluded soname"))
links_parser.set_defaults(func=self._linktest)
pkglibs_parser = subparsers.add_parser("pkglibs",
help=_("library linking test (using live system)"))
pkglibs_parser.add_argument("packages", nargs='+', default=None,
metavar="<package>",
help=_("package names"))
pkglibs_parser.set_defaults(func=self._pkglibs)
pkgs_parser = subparsers.add_parser("local",
help=_("verify local packages integrity"))
pkgs_parser.add_argument("repo", nargs='?', default=None,
metavar="<repo>", help=_("repository"))
pkgs_parser.add_argument("--quick", action="store_true",
default=not self._ask,
help=_("no stupid questions"))
pkgs_parser.set_defaults(func=self._pkgtest)
rempkgs_parser = subparsers.add_parser("remote",
help=_("verify remote packages integrity"))
rempkgs_parser.add_argument("repo", nargs='?', default=None,
metavar="<repo>", help=_("repository"))
rempkgs_parser.add_argument("--quick", action="store_true",
default=not self._ask,
help=_("no stupid questions"))
rempkgs_parser.set_defaults(func=self._rem_pkgtest)
return parser
示例8: _get_parser
def _get_parser(self):
descriptor = EitCommandDescriptor.obtain_descriptor(
EitLog.NAME)
parser = argparse.ArgumentParser(
description=descriptor.get_description(),
formatter_class=argparse.RawDescriptionHelpFormatter,
prog="%s %s" % (sys.argv[0], EitLog.NAME))
parser.add_argument("repo", nargs='?', default=None,
metavar="<repo>", help=_("repository"))
return parser
示例9: _get_parser
def _get_parser(self):
""" Overridden from EitCommand """
descriptor = EitCommandDescriptor.obtain_descriptor(
EitCheckout.NAME)
parser = argparse.ArgumentParser(
description=descriptor.get_description(),
formatter_class=argparse.RawDescriptionHelpFormatter,
prog="%s %s" % (sys.argv[0], EitCheckout.NAME))
parser.add_argument("repo", metavar="<repo>",
help=_("repository"))
return parser
示例10: _get_parser
def _get_parser(self):
""" Overridden from EitCommand """
descriptor = EitCommandDescriptor.obtain_descriptor(
EitRepo.NAME)
parser = argparse.ArgumentParser(
description=descriptor.get_description(),
formatter_class=argparse.RawDescriptionHelpFormatter,
prog="%s %s" % (sys.argv[0], EitRepo.NAME))
subparsers = parser.add_subparsers(
title="action", description=_("manage repositories"),
help=_("available commands"))
show_parser = subparsers.add_parser(
"show", help=_("show repositories and mirrors status"))
show_parser.set_defaults(func=self._show)
add_parser = subparsers.add_parser(
"add", help=_("add a repository"))
add_parser.add_argument(
"id", metavar="<repository>",
help=_("repository name"))
add_parser.add_argument(
"--desc", metavar="<description>", required=True,
help=_("repository description"))
add_parser.add_argument(
"--repo", nargs='+',
metavar="<repo uri>", required=True,
help=_("synchronization URI for both packages and database"))
add_parser.add_argument(
"--repo-only", nargs='*', default=[],
metavar="<database only uri>",
help=_("synchronization URI for database only"))
add_parser.add_argument(
"--pkg-only", nargs='*', default=[],
metavar="<packages only uri>",
help=_("synchronization URI for packages only"))
add_parser.add_argument(
"--base", action="store_true", default=None,
help=_("set this to make this repository the "
"'base' for all the others"))
add_parser.set_defaults(func=self._add)
remove_parser = subparsers.add_parser("remove",
help=_("remove a repository"))
remove_parser.add_argument(
"id", nargs='+',
metavar="<repository>",
help=_("repository name"))
remove_parser.set_defaults(func=self._remove)
return parser
示例11: _get_parser
def _get_parser(self):
""" Overridden from EitInit """
descriptor = EitCommandDescriptor.obtain_descriptor(EitInit.NAME)
parser = argparse.ArgumentParser(
description=descriptor.get_description(),
formatter_class=argparse.RawDescriptionHelpFormatter,
prog="%s %s" % (sys.argv[0], EitInit.NAME),
)
parser.add_argument("repo", nargs=1, default=None, metavar="<repo>", help=_("repository"))
parser.add_argument("--quick", action="store_true", default=not self._ask, help=_("no stupid questions"))
return parser
示例12: _get_parser
def _get_parser(self):
""" Overridden from EitCommit """
descriptor = EitCommandDescriptor.obtain_descriptor(EitRepack.NAME)
parser = argparse.ArgumentParser(
description=descriptor.get_description(),
formatter_class=argparse.RawDescriptionHelpFormatter,
prog="%s %s" % (sys.argv[0], EitRepack.NAME),
)
parser.add_argument("packages", nargs="+", metavar="<package>", help=_("package names"))
parser.add_argument(
"--in", metavar="<repository>", help=_("repack to given repository"), default=None, dest="into"
)
return parser
示例13: _get_parser
def _get_parser(self):
descriptor = EitCommandDescriptor.obtain_descriptor(EitFiles.NAME)
parser = argparse.ArgumentParser(
description=descriptor.get_description(),
formatter_class=argparse.RawDescriptionHelpFormatter,
prog="%s %s" % (sys.argv[0], EitFiles.NAME),
)
parser.add_argument("packages", nargs="+", metavar="<package>", help=_("package names"))
parser.add_argument(
"--quiet", "-q", action="store_true", default=self._quiet, help=_("quiet output, for scripting purposes")
)
return parser
示例14: _get_parser
def _get_parser(self):
descriptor = EitCommandDescriptor.obtain_descriptor(
EitDeps.NAME)
parser = argparse.ArgumentParser(
description=descriptor.get_description(),
formatter_class=argparse.RawDescriptionHelpFormatter,
prog="%s %s" % (sys.argv[0], EitDeps.NAME))
parser.add_argument("packages", nargs='+', metavar="<package>",
help=_("package name"))
parser.add_argument("--in", metavar="<repository>",
help=_("inject into given repository"),
dest="inrepo", default=None)
return parser
示例15: _get_parser
def _get_parser(self):
""" Overridden from EitCommand """
descriptor = EitCommandDescriptor.obtain_descriptor(
EitBump.NAME)
parser = argparse.ArgumentParser(
description=descriptor.get_description(),
formatter_class=argparse.RawDescriptionHelpFormatter,
prog="%s %s" % (sys.argv[0], EitBump.NAME))
parser.add_argument("repo", nargs='?', default=None,
metavar="<repo>", help=_("repository"))
parser.add_argument("--sync", action="store_true",
default=self._sync,
help=_("sync with remote repository"))
return parser