#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
from natrixclient.common.natrix_logging import NatrixLogging
from natrixclient.manage import start, stop

logger = NatrixLogging()


if __name__ == "__main__":
    if len(sys.argv) < 2:
        print("should choose action: start/stop")
        exit(1)
    if sys.argv[1].lower() == "start":
        logger.debug("natrixclient daemon starting ......")
        start()
        logger.debug("natrixclient daemon started")
    elif sys.argv[1].lower() == "stop":
        logger.debug("natrixclient daemon stopping ...")
        stop()
        logger.debug("natrixclient daemon stopped")
    else:
        print("Do not support action {}, please support start/stop".format(sys.argv[1]))
        exit(2)
