import sys
from .Version import VersionHandler
from .Resource import DataProvider

def DoGetVersion():
    VersionHandler.GetVersion()

def DoCopyLegacy(dstPath):
    DataProvider.CopyWebData(dstPath)

def DoCopyModern(dstPath):
    DataProvider.CopyWebUI2024Data(dstPath)

def Main():
    # コマンドライン引数
    args = sys.argv

    if(len(args) == 2):
        if(args[1] == "getversion"):
            # HeliodorLibのバージョンを取得
            DoGetVersion()
        else:
            # 無効なコマンドライン引数
            print(f"%s[Error] Invalid command line argument passed.%s" % ('\033[31m', '\033[0m'))
            return
    elif(len(args) == 3):
        if(args[1] == "copylegacy"):
            # 旧UIのリソースをコピー
            dstPath = args[2]
            DoCopyLegacy(dstPath)
        elif(args[1] == "copymodern"):
            # 新UIのリソースをコピー
            dstPath = args[2]
            DoCopyModern(dstPath)
        else:
            # 無効なコマンドライン引数
            print(f"%s[Error] Invalid command line argument passed.%s" % ('\033[31m', '\033[0m'))
            return
    else:
        # 無効なコマンドライン引数
        print(f"%s[Error] Invalid command line argument passed.%s" % ('\033[31m', '\033[0m'))
        return

Main()