Ejemplo n.º 1
0
    def powercmd_complete(text):
        from powercmd.utils import match_instance, get_available_instance_names
        from powercmd.match_string import match_string

        paren_idx = text.find('(')
        if paren_idx >= 0:
            # argument completion
            opt_name = text[:paren_idx]
            if opt_name == 'Option':
                ctor = Option
            else:
                ctor = match_instance(Option, text[:paren_idx],
                                      match_extra_cls=[OptionConstructor])
                if not ctor:
                    return []
                elif isinstance(ctor, OptionConstructor):
                    ctor = ctor.content_mapper

            sig = inspect.signature(ctor)

            # the '' is a hack to prevent Cmd from actually inserting the completion
            return ['', str(sig)]

        possible = get_available_instance_names(Option,
                                                match_extra_cls=[OptionConstructor],
                                                append_paren_to_callables=True)
        return match_string(text, possible)
Ejemplo n.º 2
0
    def powercmd_complete(text):
        from powercmd.utils import match_instance, get_available_instance_names
        from powercmd.match_string import match_string

        paren_idx = text.find('(')
        if paren_idx >= 0:
            # argument completion
            opt_name = text[:paren_idx]
            if opt_name == 'Option':
                ctor = Option
            else:
                ctor = match_instance(Option, text[:paren_idx],
                                      match_extra_cls=[OptionConstructor])
                if not ctor:
                    return []

            if isinstance(ctor, OptionConstructor):
                ctor = ctor.content_mapper

            sig = inspect.signature(ctor)

            # the '' is a hack to prevent Cmd from actually inserting the completion
            return ['', str(sig)]

        possible =  get_available_instance_names(Option,
                                                 match_extra_cls=[OptionConstructor],
                                                 append_paren_to_callables=True)
        return match_string(text, possible)
Ejemplo n.º 3
0
    def powercmd_complete(text):
        from powercmd.utils import get_available_instance_names
        from powercmd.match_string import match_string

        possible = get_available_instance_names(ContentFormatOption)
        return match_string(text, possible)
Ejemplo n.º 4
0
    def powercmd_complete(text):
        from powercmd.utils import get_available_instance_names
        from powercmd.match_string import match_string

        possible = get_available_instance_names(Code)
        return match_string(text, possible)
Ejemplo n.º 5
0
 def powercmd_complete(text):
     possible = get_available_instance_names(ContentFormatOption)
     return match_string(text, possible)