#!/usr/bin/env python3
# OTP-CR-117/19 otp.informationdesk@icc-cpi.int http://pypi.org/project/genocide
#
# This file is placed in the Public Domain.

"console"

# imports

from op.run import Console, cfg, exec, parse_cli, os

# defines

cfg.wd = os.path.expanduser("~/.kamer")

# classes

class Console(Console):

    def direct(self, txt):
        print(txt)

# functions

def main():
    parse_cli()
    h = Console()
    h.tablename = "kamer.tbl"
    h.fromdir(os.path.join(cfg.wd, "mod"))
    h.load_mod("cli,cmd,irc,usr,ver")
    h.load_mod(cfg.mods)
    if cfg.txt:
        return h.cmd(cfg.otxt)
    if cfg.op("c"):
        h.start()
        h.init(cfg.mods)
        h.wait()

# runtime

exec(main)
