#!python
# encoding: utf-8
# py_help 框架辅助入口
# 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:
            # 已安装工具集，将参数导入到vst工具中解析执行
            from py_help.cli.router import router

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