コード例 #1
0
 def complete(self, context, **kwargs):
     return [
         NullComplete('name='),
         NullComplete('author='),
         NullComplete('mail='),
         NullComplete('description=')
     ]
コード例 #2
0
ファイル: crypto.py プロジェクト: surajrav/cli
 def complete(self, context, **kwargs):
     return [
         NullComplete('name='),
         EnumComplete('type=', ['CERT_EXISTING', 'CA_EXISTING']),
         NullComplete('certificate_path='),
         NullComplete('privatekey_path='),
     ]
コード例 #3
0
ファイル: tasks.py プロジェクト: caymanowl/cli
 def complete(self, context):
     return [
         NullComplete('all'),
         NullComplete('aborted'),
         NullComplete('finished'),
         NullComplete('failed'),
         NullComplete('running')
     ]
コード例 #4
0
 def complete(self, context):
     return [
         NullComplete('name='),
         NullComplete('address='),
         NullComplete('username='******'password='******'port=')
     ]
コード例 #5
0
 def complete(self, context):
     return [
         NullComplete('name='),
         NullComplete('master='),
         NullComplete('slave='),
         NullComplete('datasets='),
         EnumComplete('recursive=', ['yes', 'no']),
         EnumComplete('bidirectional=', ['yes', 'no']),
         EnumComplete('replicate_services=', ['yes', 'no'])
     ]
コード例 #6
0
ファイル: volumes.py プロジェクト: caymanowl/cli
 def complete(self, context):
     return [
         NullComplete('name='),
         EnumComplete('layout=', VOLUME_LAYOUTS.keys()),
         EnumComplete('type=', VOLUME_LAYOUTS.keys()),
         EnumComplete('encryption=', ['yes', 'no']),
         NullComplete('password='******'disks=', 'disk', lambda d: d['name'], ['auto'], list=True),
         EntitySubscriberComplete('cache=', 'disk', lambda d: d['name'], ['auto'], list=True),
         EntitySubscriberComplete('log=', 'disk', lambda d: d['name'], ['auto'], list=True),
     ]
コード例 #7
0
    def complete(self, context, **kwargs):
        props = []
        name = q.get(kwargs, 'kwargs.image')
        if name:
            image = context.entity_subscribers['docker.image'].query(('names', 'in', name), single=True)
            if not image:
                image = q.query(DockerImageNamespace.default_images, ('name', '=', name), single=True)

            if image and image['presets']:
                presets = image['presets']
                props += [NullComplete('{id}='.format(**i)) for i in presets['settings']]
                props += [NullComplete('volume:{container_path}='.format(**v)) for v in presets['volumes']]
                props += [NullComplete('port:{container_port}/{protocol}='.format(**v)) for v in presets['ports']]

        available_images = q.query(DockerImageNamespace.default_images, select='name')
        available_images += context.entity_subscribers['docker.image'].query(select='names.0')
        available_images = list(set(available_images))

        return props + [
            NullComplete('name='),
            NullComplete('command='),
            NullComplete('hostname='),
            NullComplete('volume:'),
            NullComplete('port:'),
            EnumComplete('image=', available_images),
            EntitySubscriberComplete('host=', 'docker.host', lambda i: q.get(i, 'name')),
            EnumComplete('interactive=', ['yes', 'no']),
            EnumComplete('autostart=', ['yes', 'no']),
            EnumComplete('expose_ports=', ['yes', 'no']),
        ]
コード例 #8
0
ファイル: commands.py プロジェクト: mactanxin/cli
def create_variable_completer(name, var):
    if var.type == ValueType.BOOLEAN:
        return EnumComplete(name + '=', ['yes', 'no'])

    if var.choices:
        return EnumComplete(name + '=', var.choices)

    return NullComplete(name + '=')
コード例 #9
0
ファイル: namespace.py プロジェクト: caymanowl/cli
def create_completer(prop):
    if prop.enum:
        enum_val = prop.enum() if callable(prop.enum) else prop.enum
        return EnumComplete(prop.name + '=', enum_val)

    if prop.type == ValueType.BOOLEAN:
        return EnumComplete(prop.name + '=', ['yes', 'no'])

    return NullComplete(prop.name + '=')
コード例 #10
0
    def complete(self, context, **kwargs):
        props = []
        username = q.get(kwargs, 'kwargs.username')
        password = q.get(kwargs, 'kwargs.password')
        if username and password:
            if not self.ticket_categories:
                self.ticket_categories.update(
                    context.call_sync('support.categories', str(username),
                                      str(password)))

        if self.ticket_categories:
            props += [
                EnumComplete('category=', list(self.ticket_categories.keys()))
            ]
            props += [NullComplete('subject=')]
            props += [NullComplete('description=')]
            props += [EnumComplete('type=', ['bug', 'feature'])]
            props += [EnumComplete('attach_debug_data=', ['yes', 'no'])]
            props += [NullComplete('attachments=')]

        return props + [
            NullComplete('username='******'password='),
        ]
コード例 #11
0
ファイル: namespace.py プロジェクト: mactanxin/cli
def create_completer(prop, obj=None):
    if prop.complete:
        return prop.complete
    else:
        if prop.enum:
            if callable(prop.enum):
                enum_val = prop.enum(obj) if obj else []
            else:
                enum_val = prop.enum
            return EnumComplete(prop.name + '=', enum_val)

        if prop.type == ValueType.BOOLEAN:
            return EnumComplete(prop.name + '=', ['yes', 'no'])

        return NullComplete(prop.name + '=')
コード例 #12
0
ファイル: system.py プロジェクト: mactanxin/cli
 def complete(self, context, **kwargs):
     return [
         NullComplete('path='),
     ]
コード例 #13
0
ファイル: system.py プロジェクト: mactanxin/cli
 def complete(self, context, **kwargs):
     return [NullComplete('ignore_volumes=')]
コード例 #14
0
ファイル: crypto.py プロジェクト: caymanowl/cli
 def complete(self, context):
     return [
         NullComplete('name='),
         EnumComplete('type=', ['CERT_EXISTING'])
     ]
コード例 #15
0
ファイル: backup.py プロジェクト: zoot/cli
 def complete(self, context, **kwargs):
     return [
         EntitySubscriberComplete('dataset=', 'volume.dataset'),
         NullComplete('snapshot=')
     ]
コード例 #16
0
 def complete(self, context, **kwargs):
     return [
         NullComplete('name=')
     ]