def onecmd(self, line):
        """Mostly ripped from Python's cmd.py"""
        if line[:1] == '.':
            cmd, arg, line = self.parseline(line[1:])
        else:
            cmd = None
        if not line:
            return self.emptyline()
        if cmd is None:
            return self.default(line)
        self.lastcmd = line
        if cmd == '':
            return self.default(line)
        else:
            try:
                func = getattr(self, 'do_' + cmd)
            except AttributeError:
                return self.default(line)
            return func(arg)
Mostly ripped from Python's cmd.py
bin/sqlite.py