@echo off
SETLOCAL EnableDelayedExpansion
echo %cmdcmdline% | findstr /i /c:"%~nx0" >NUL && set iscommandline=1
echo %PSModulePath% | findstr /i /c:"%USERPROFILE%" >NUL && set ispowershell=1
cd /D "%~dp0"

SET UserModuleTag=
IF "%~1"=="" (
    echo Module tag not specified.
    set /p UserModuleTag=Insert module tag: 
    IF "!UserModuleTag!"=="" (
        echo Module tag is required to extract internals!
        exit /b 1
    ) ELSE (
        echo Using module tag: !UserModuleTag!
        set ModuleTag=!UserModuleTag!
    )
) ELSE (
    echo Using module tag: %~1
    set ModuleTag=%~1
)

@powershell -NoProfile -ExecutionPolicy Bypass -Command .\scripts\extract-elx-internals.ps1 -ModuleTag %ModuleTag%

IF DEFINED iscommandline IF NOT DEFINED ispowershell pause
ENDLOCAL
