#!python

"""
Copyright 2015-2017 Hermann Krumrey

This file is part of kudubot.

kudubot is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

kudubot is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with kudubot.  If not, see <http://www.gnu.org/licenses/>.
"""

import os
import sys
from kudubot.main import main

if __name__ == "__main__":

    config_dir = os.path.join(os.path.expanduser("~"), ".kudubot-echo")

    if not os.path.isdir(config_dir):
        print("Configuration directory does not exist.")
        print("Execute "
              "\"kudubot-config-gen --destination ~/.kudubot-echo "
              "--services EchoService --connections Cli,...\" "
              "and set up the connection to use to continue")
        sys.exit(1)

    if "-c" in sys.argv or "--config" in sys.argv:
        print("Please don't manually specify a configuration directory")
        sys.exit(1)

    sys.argv.append("-c")
    sys.argv.append(config_dir)
    main()
