当前位置: 首页>>代码示例>>Python>>正文


Python VirtualConsoleArgumentParser.add_argument方法代码示例

本文整理汇总了Python中opennode.oms.endpoint.ssh.cmdline.VirtualConsoleArgumentParser.add_argument方法的典型用法代码示例。如果您正苦于以下问题:Python VirtualConsoleArgumentParser.add_argument方法的具体用法?Python VirtualConsoleArgumentParser.add_argument怎么用?Python VirtualConsoleArgumentParser.add_argument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在opennode.oms.endpoint.ssh.cmdline.VirtualConsoleArgumentParser的用法示例。


在下文中一共展示了VirtualConsoleArgumentParser.add_argument方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: arguments

# 需要导入模块: from opennode.oms.endpoint.ssh.cmdline import VirtualConsoleArgumentParser [as 别名]
# 或者: from opennode.oms.endpoint.ssh.cmdline.VirtualConsoleArgumentParser import add_argument [as 别名]
    def arguments(self):
        parser = VirtualConsoleArgumentParser()
        parser.add_argument('path')

        group = parser.add_mutually_exclusive_group(required=True)
        group.add_argument('-p', action='store_true', help="Show effective permissions for a given object")
        group.add_argument('-r', action=MergeListAction,
                           help="Check if the user has some rights on a given object")
        return parser
开发者ID:AsherBond,项目名称:opennode-management,代码行数:11,代码来源:security.py

示例2: arguments

# 需要导入模块: from opennode.oms.endpoint.ssh.cmdline import VirtualConsoleArgumentParser [as 别名]
# 或者: from opennode.oms.endpoint.ssh.cmdline.VirtualConsoleArgumentParser import add_argument [as 别名]
    def arguments(self):
        parser = VirtualConsoleArgumentParser()

        obj = self.current_obj

        choices = []
        if getattr(obj, '__contains__', None):
            for name, cls in creatable_models.items():
                if obj.can_contain(cls):
                    choices.append(name)

        parser.add_argument('type', choices=choices, help="object type to be created")
        return parser
开发者ID:AsherBond,项目名称:opennode-management,代码行数:15,代码来源:commands.py

示例3: arguments

# 需要导入模块: from opennode.oms.endpoint.ssh.cmdline import VirtualConsoleArgumentParser [as 别名]
# 或者: from opennode.oms.endpoint.ssh.cmdline.VirtualConsoleArgumentParser import add_argument [as 别名]
 def arguments(self):
     parser = VirtualConsoleArgumentParser()
     parser.add_argument('-t', action='store_true', help='Force tracking changes')
     parser.add_argument('-s', help='Show details for particular types')
     parser.add_argument('-d', action='store_true', help='Step into debugger')
     parser.add_argument('-b', action='store_true', help='Step into debugger in DB thread')
     return parser
开发者ID:AsherBond,项目名称:opennode-management,代码行数:9,代码来源:memory_profiler.py

示例4: arguments

# 需要导入模块: from opennode.oms.endpoint.ssh.cmdline import VirtualConsoleArgumentParser [as 别名]
# 或者: from opennode.oms.endpoint.ssh.cmdline.VirtualConsoleArgumentParser import add_argument [as 别名]
    def arguments(self):
        parser = VirtualConsoleArgumentParser()
        parser.add_argument('paths', nargs='+',
                            help='Prototype template to be used to find all similar ones')

        group = parser.add_mutually_exclusive_group(required=True)
        group.add_argument('-i', action='store_true',
                           help='Set object to inherit permissions from its parent(s)',
                           default=False)
        group.add_argument('-m', action='append',
                           help="add an Allow ace: {u:[user]:permspec|g:[group]:permspec}")
        group.add_argument('-d', action='append',
                           help="add an Deny ace: {u:[user]:permspec|g:[group]:permspec}")
        group.add_argument('-x', action='append',
                           help="remove an ace: {u:[user]:permspec|g:[group]:permspec}")

        return parser
开发者ID:murisfurder,项目名称:opennode-knot,代码行数:19,代码来源:template.py

示例5: arguments

# 需要导入模块: from opennode.oms.endpoint.ssh.cmdline import VirtualConsoleArgumentParser [as 别名]
# 或者: from opennode.oms.endpoint.ssh.cmdline.VirtualConsoleArgumentParser import add_argument [as 别名]
 def arguments(self):
     parser = VirtualConsoleArgumentParser()
     parser.add_argument('user', help='User name')
     parser.add_argument('paths', nargs='+', help='List of paths')
     parser.add_argument('-R', '--recursive', action='store_true',
                         help='Change ownership recursively', default=False, required=False)
     return parser
开发者ID:bbc88ks,项目名称:opennode-management,代码行数:9,代码来源:security.py

示例6: CmdLineParserTestCase

# 需要导入模块: from opennode.oms.endpoint.ssh.cmdline import VirtualConsoleArgumentParser [as 别名]
# 或者: from opennode.oms.endpoint.ssh.cmdline.VirtualConsoleArgumentParser import add_argument [as 别名]
class CmdLineParserTestCase(unittest.TestCase):

    def setUp(self):
        self.terminal = mock.Mock()
        self.parser = VirtualConsoleArgumentParser(file=self.terminal)

    def test_help(self):
        self.parser.add_argument('somearg')

        self.parser.print_help()

        assert len(self.terminal.method_calls) == 1
        eq_(self.terminal.method_calls[0][0], 'write')

    def test_exit(self):
        got_exception = False
        try:
            self.parser.parse_args(['--invalid'])
        except ArgumentParsingError:
            got_exception = True

        assert got_exception

    def test_group_dict(self):
        self.parser.add_argument('--one', type=int, action=GroupDictAction)
        self.parser.add_argument('--two', type=int, action=GroupDictAction)
        self.parser.add_argument('--three', type=int, action=GroupDictAction, group='other')

        res = self.parser.parse_args('--one 1 --two 2 --three 3'.split())
        eq_(res.group, dict(one=1, two=2))
        eq_(res.other, dict(three=3))

    def test_declaration(self):
        some_default = object()
        self.parser.declare_argument('group', some_default)
        res = self.parser.parse_args([])

        eq_(res.group, some_default)
开发者ID:AsherBond,项目名称:opennode-management,代码行数:40,代码来源:test_cmdline.py

示例7: arguments

# 需要导入模块: from opennode.oms.endpoint.ssh.cmdline import VirtualConsoleArgumentParser [as 别名]
# 或者: from opennode.oms.endpoint.ssh.cmdline.VirtualConsoleArgumentParser import add_argument [as 别名]
 def arguments(self):
     parser = VirtualConsoleArgumentParser()
     parser.add_argument('-f', '--full', action='store_true',
                        help='Perform full sync',
                        default=False)
     return parser
开发者ID:AsherBond,项目名称:opennode-knot,代码行数:8,代码来源:syncaction.py

示例8: arguments

# 需要导入模块: from opennode.oms.endpoint.ssh.cmdline import VirtualConsoleArgumentParser [as 别名]
# 或者: from opennode.oms.endpoint.ssh.cmdline.VirtualConsoleArgumentParser import add_argument [as 别名]
 def arguments(self):
     parser = VirtualConsoleArgumentParser()
     parser.add_argument('host', nargs='+', help="Host or compute object")
     return parser
开发者ID:AsherBond,项目名称:opennode-knot,代码行数:6,代码来源:ping.py

示例9: arguments

# 需要导入模块: from opennode.oms.endpoint.ssh.cmdline import VirtualConsoleArgumentParser [as 别名]
# 或者: from opennode.oms.endpoint.ssh.cmdline.VirtualConsoleArgumentParser import add_argument [as 别名]
 def arguments(self):
     parser = VirtualConsoleArgumentParser()
     parser.add_argument('-u', help="Stop all VMs belonging to the user")
     return parser
开发者ID:murisfurder,项目名称:opennode-knot,代码行数:6,代码来源:compute.py

示例10: arguments

# 需要导入模块: from opennode.oms.endpoint.ssh.cmdline import VirtualConsoleArgumentParser [as 别名]
# 或者: from opennode.oms.endpoint.ssh.cmdline.VirtualConsoleArgumentParser import add_argument [as 别名]
 def arguments(self):
     parser = VirtualConsoleArgumentParser()
     parser.add_argument('oids', nargs='+', help="List of OIDs to retrieve from DB")
     parser.add_argument('--tid', nargs='?', help="Transaction ID which the objects to retrieve for")
     return parser
开发者ID:AsherBond,项目名称:opennode-management,代码行数:7,代码来源:dbadmin.py

示例11: arguments

# 需要导入模块: from opennode.oms.endpoint.ssh.cmdline import VirtualConsoleArgumentParser [as 别名]
# 或者: from opennode.oms.endpoint.ssh.cmdline.VirtualConsoleArgumentParser import add_argument [as 别名]
 def arguments(self):
     parser = VirtualConsoleArgumentParser()
     parser.add_argument('-f', '--free', action='store_true', help='Mark IP as free')
     parser.add_argument('-u', '--use', action='store_true', help='Mark IP as used')
     parser.add_argument('ip')
     return parser
开发者ID:AsherBond,项目名称:opennode-knot,代码行数:8,代码来源:network.py


注:本文中的opennode.oms.endpoint.ssh.cmdline.VirtualConsoleArgumentParser.add_argument方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。