Exemple #1
0
    def followCurrent(self):
        """Fetches link  from current cmd and tries to follow it."""
        lg.debug("cli::followCurrent " +
                 str(self.currObject.currLine))
        link = self.currObject.getLink(self.currObject.currLine)

        c = comments(link.addr, rLimit=100)
        if c.ok:
            self.setCurrentObject(c)
        else:
            self.setCurrentObject(error(c.status))

        self.clear()
Exemple #2
0
    def __init__(self, config):
        lg.debug("cli::__init__")
        self.stdscr = curses.initscr()
        curses.noecho()
        curses.cbreak()
        self.stdscr.keypad(1)
        curses.curs_set(0)

        self.maxY, self.maxX = self.stdscr.getmaxyx()

        self.MAX_LIST_ITEMS = self.maxY - BOTTOM_OFFSET - 2

        lg.debug("Maximum number for items is " +
                 str(self.MAX_LIST_ITEMS))
        self.MODE = mode.VIM

        hm = config.get("history_max", 5)

        self.browser = config.get("browser", None)
        self.history = history(hm)

        self.currObject = None

        self.msg = None
        self.setMsg("Revi started, config loaded from file, "
                    "word peace achieved")

        self.drawLoading()

        l = listing("", rLimit=self.MAX_LIST_ITEMS)
        if l.ok:
            self.setCurrentObject(l)
        else:
            self.setCurrentObject(error(l.status))

        if self.MODE is mode.VIM:
            self.eval = eval_vim(self.stdscr)
        else:
            # self.eval = eval_emacs(self.stdscr)
            pass

        self.help = help()