Interface.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:gitcd 作者: claudio-walser 项目源码 文件源码
def completeOptions(self, text, state):
        # need to simplify this much more
        buffer = readline.get_line_buffer()
        line = readline.get_line_buffer().split()
        # show all commands
        if not line:
            return [c + ' ' for c in self.options][state]

        # account for last argument ending in a space
        if self.re.match(buffer):
            line.append('')

        # resolve command to the implementation function
        cmd = line[0].strip()
        if cmd in self.options:
            args = line[1:]
            if args:
                return False
            return [cmd + ' '][state]
        results = [c + ' ' for c in self.options if c.startswith(cmd)] + [None]
        return results[state]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号