Skip to content

Instantly share code, notes, and snippets.

@quienn
Last active August 16, 2022 01:53
Show Gist options
  • Save quienn/cee1332c17f6cf32e2928f92cdd023c1 to your computer and use it in GitHub Desktop.
Save quienn/cee1332c17f6cf32e2928f92cdd023c1 to your computer and use it in GitHub Desktop.
lite's Plugin Manager for Windows
@ECHO OFF
SET GITHUB_URL=https://raw.githubusercontent.com/rxi/lite-plugins/master/plugins
SET PLUGIN_DIR=%ProgramFiles%\lite\data\plugins
SET /A DOWNLOAD_COUNT=0
:main
FOR /F "tokens=*" %%A in (%USERPROFILE%\.lite_plugins) do (
IF EXIST "%PLUGIN_DIR%\%%A.lua" (
IF "%~1"=="" (
ECHO Skipping %%A...
) ELSE (
IF "%~1"=="refresh" (
CALL :download_file "%%A" "%GITHUB_URL%/%%A.lua" "%PLUGIN_DIR%\%%A.lua"
) ELSE (
ECHO Unknown command %~1
EXIT /B 1
)
)
) ELSE (
CALL :download_file "%%A" "%GITHUB_URL%/%%A.lua" "%PLUGIN_DIR%\%%A.lua"
)
)
IF "%~1%"=="refresh" (
ECHO Refreshed %DOWNLOAD_COUNT% plugins.
) ELSE (
ECHO Installed %DOWNLOAD_COUNT% plugins.
)
EXIT /B
:download_file
bitsadmin /TRANSFER %~1 /DOWNLOAD /PRIORITY normal %~2 "%~3"
SET /A DOWNLOAD_COUNT=%DOWNLOAD_COUNT%+1
EXIT /B
@quienn
Copy link
Author

quienn commented Aug 16, 2022

Limitations: It only supports plugins from rxi's repo. I'm planning on adding third-party repos support. I'm currently using this for my own lite setup and I haven't found any issues yet. 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment