import StringIO
from cmd import Cmd

try:
    import weechat
    weechat.register ("Foobar", "0", "", "")
    weechat.add_command_handler(
        "foobar",
        "foobar",
        "blah",
        "blah",
        "blah",
        ""
        )

except:
    pass

def foobar (server, args):
    return weechat.PLUGIN_RC_OK

class CommandlineJunk(Cmd):
    def __init__(self, inputfile, outputfile):
        Cmd.__init__(self, 'Tab', inputfile, outputfile)
        self.cmdqueue = [r"echo"]

    def preloop(self):
        Cmd.preloop(self)

    def precmd(self, line):
        return line
    
    def postcmd(self, stop, line):
        return True

    def emptyline(self): pass

fakestdin = StringIO.StringIO()
fakestdout = StringIO.StringIO()

c = CommandlineJunk(fakestdin, fakestdout)
c.cmdloop()
