#!python
# encoding: utf-8
# py_help entrance
# create by wwl @ 2017-12-12
import sys
import os


class Installer:
    def __init__(self):
        pass

    def install(self):
        os.system(
            "{py} -m pip install py_help".format(
                py=sys.executable))


if __name__ == '__main__':
    if sys.argv[-1] == 'install':
        installer = Installer()
        installer.install()
    else:
        try:
            import py_help
        except ImportError:
            installer = Installer()
            installer.install()
        finally:
            from py_help.cli.router import router

            router.run(sys.argv[1:])
