Esempio n. 1
0
    def autocomplete(self):
        """
        If *completion* is enabled, this method would write to ``self.stdout``
        completion words separated with space.
        """
        if self.completion_env_var_name not in os.environ:
            return
        cwords = os.environ['COMP_WORDS'].split()[1:]
        cword = int(os.environ['COMP_CWORD'])
        try:
            current = cwords[cword-1]
        except IndexError:
            current = ''
        cmd_names = self.get_commands().keys()

        if current:
            self.stdout.write(unicode(' '.join(
                [name for name in cmd_names if name.startswith(current)])))

        sys.exit(1)
Esempio n. 2
0
    def autocomplete(self):
        """
        If *completion* is enabled, this method would write to ``self.stdout``
        completion words separated with space.
        """
        if self.completion_env_var_name not in os.environ:
            return
        cwords = os.environ['COMP_WORDS'].split()[1:]
        cword = int(os.environ['COMP_CWORD'])
        try:
            current = cwords[cword - 1]
        except IndexError:
            current = ''
        cmd_names = self.get_commands().keys()

        if current:
            self.stdout.write(
                unicode(' '.join(
                    [name for name in cmd_names if name.startswith(current)])))

        sys.exit(1)
Esempio n. 3
0
 def handle(self, namespace):
     self.stdout.write(unicode(self.get_completion_snippet()))
Esempio n. 4
0
 def _print_message(self, message, file=None):
     if file is None:
         file = self.stream
     super(Parser, self)._print_message(unicode(message), file)
Esempio n. 5
0
 def handle(self, namespace):
     self.stdout.write(unicode(self.get_completion_snippet()))
Esempio n. 6
0
 def _print_message(self, message, file=None):
     if file is None:
         file = self.stream
     super(Parser, self)._print_message(unicode(message), file)