Example #1
0
    def gather_candidates(self, context):
        if not self.vars['command']:
            return []

        directory = context['__directory']
        if not Path(directory).is_dir():
            return []

        if context['is_redraw'] and directory in self._cache:
            self._cache.pop(directory)
        if directory in self._cache:
            return self._cache[directory]

        if context['__proc']:
            return self._async_gather_candidates(context,
                                                 context['async_timeout'])

        if ':directory' in self.vars['command']:
            args = parse_command(self.vars['command'], directory=directory)
        else:
            args = self.vars['command'] + [directory]
        if shutil.which(args[0]) is None:
            self.error_message(context, args[0] + ' is not executable.')
            return []
        self.print_message(context, args)
        context['__proc'] = Process(args, context, directory)
        context['__current_candidates'] = []
        return self._async_gather_candidates(context, 0.5)
Example #2
0
    def gather_candidates(self, context):
        if not self.vars['command']:
            return []

        if context['__proc']:
            return self.__async_gather_candidates(
                context, context['async_timeout'])

        if context['is_redraw']:
            self.__cache = {}

        directory = context['__directory']
        if not isdir(directory):
            return []

        if directory in self.__cache:
            return self.__cache[directory]

        if ':directory' in self.vars['command']:
            args = parse_command(
                self.vars['command'], directory=directory)
        else:
            args = self.vars['command'] + [directory]
        self.print_message(context, args)
        context['__proc'] = Process(args, context, directory)
        context['__current_candidates'] = []
        return self.__async_gather_candidates(context, 0.5)
Example #3
0
    def gather_candidates(self, context):
        if self.__proc:
            return self.__async_gather_candidates(context, 0.5)

        if context['is_redraw']:
            self.__cache = {}

        directory = context['__directory']

        if directory in self.__cache:
            return self.__cache[directory]

        command = copy(self.vars['command'])
        if not command:
            if context['is_windows']:
                return []

            command = [
                'find', '-L', directory, '-path', '*/.git/*', '-prune', '-o',
                '-type', 'l', '-print', '-o', '-type', 'f', '-print'
            ]
        else:
            if ":directory" in command:
                command = parse_command(command, directory=directory)
            else:
                command.append(directory)
        self.__proc = Process(command, context, directory)
        self.__current_candidates = []
        return self.__async_gather_candidates(context, 2.0)
Example #4
0
    def gather_candidates(self, context):
        if not self.vars['command']:
            return []

        if context['__proc']:
            return self.__async_gather_candidates(
                context, context['async_timeout'])

        if context['is_redraw']:
            self.__cache = {}

        directory = context['__directory']
        if not isdir(directory):
            return []

        if directory in self.__cache:
            return self.__cache[directory]

        if ':directory' in self.vars['command']:
            args = parse_command(
                self.vars['command'], directory=directory)
        else:
            args = self.vars['command'] + [directory]
        self.print_message(context, args)
        context['__proc'] = Process(args, context, directory)
        context['__current_candidates'] = []
        return self.__async_gather_candidates(context, 0.5)
Example #5
0
File: rec.py Project: skeept/dotvim
    def gather_candidates(self, context):
        if not self.vars['command']:
            return []

        directory = context['__directory']
        if not Path(directory).is_dir():
            return []

        if context['is_redraw'] and directory in self._cache:
            self._cache.pop(directory)
        if directory in self._cache:
            return self._cache[directory]

        if context['__proc']:
            return self._async_gather_candidates(
                context, context['async_timeout'])

        if ':directory' in self.vars['command']:
            args = parse_command(
                self.vars['command'], directory=directory)
        else:
            args = self.vars['command'] + [directory]
        if shutil.which(args[0]) is None:
            self.error_message(context, args[0] + ' is not executable.')
            return []
        self.print_message(context, args)
        context['__proc'] = Process(args, context, directory)
        context['__current_candidates'] = []
        return self._async_gather_candidates(context, 0.5)
Example #6
0
    def gather_candidates(self, context):
        if context['__proc']:
            return self.__async_gather_candidates(context,
                                                  context['async_timeout'])

        if context['is_redraw']:
            self.__cache = {}

        directory = context['__directory']

        if directory in self.__cache:
            return self.__cache[directory]

        if ':directory' in self.vars['command']:
            command = parse_command(self.vars['command'], directory=directory)
        else:
            command = self.vars['command'] + [directory]
        context['__proc'] = Process(command, context, directory)
        context['__current_candidates'] = []
        return self.__async_gather_candidates(context, 0.5)
Example #7
0
    def gather_candidates(self, context):
        if context['__proc']:
            return self.__async_gather_candidates(context, 0.5)

        if context['is_redraw']:
            self.__cache = {}

        directory = context['__directory']

        if directory in self.__cache:
            return self.__cache[directory]

        if ':directory' in self.vars['command']:
            command = parse_command(
                self.vars['command'], directory=directory)
        else:
            command = self.vars['command'] + [directory]
        context['__proc'] = Process(command, context, directory)
        context['__current_candidates'] = []
        return self.__async_gather_candidates(context, 2.0)