mor

Cross platform dependency manager

commit 330754bcad946266e637dfee9a4aa79807787612
parent df7f27ca47c788a56227badef8e039f3754ac60d
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Sat, 12 Oct 2024 16:05:09 +0530

Fix show proper error when a key is not matching for a target

Fix error messages for targets when curl fails

Update README to inform download preference

Update requirements.ini with more test cases
3 files changed, 24 insertions(+), 7 deletions(-)
M
README
|
6
++----
M
mor.cmd
|
15
+++++++++++++--
M
requirements.ini
|
10
+++++++++-
diff --git a/README b/README
@@ -139,11 +139,9 @@ Example
 
 Windows
 -------
-- bitsadmin.exe is used to download files in Windows as 'curl' is not available in older versions of Windows.
+- curl is the preferred downloader for windows, but if it is missing, mor defaults to bitsadmin.exe which is available in older versions of Windows.
 
-If you face extreme slowness in downloads, it's probably because some other application is using bitsadmin to download something (like Windows Update)
-
-If you are on a hurry, you can do
+If you face extreme slowness in downloads when using bitsadmin, it's probably because some other application is using it to download something (like Windows Update).If you are on a hurry, you can do
 
 	C:\Users\Admin> bitsadmin /reset
 
diff --git a/mor.cmd b/mor.cmd
@@ -88,7 +88,17 @@ setlocal EnableDelayedExpansion
 		)
 		for /f "usebackq tokens=1,2,3* delims=[]=" %%e in (`set  [%%a[`) do (
 			if "%%~f"=="%~2-%~3" (
-				call :prime_download %%e %%~f %%~g || exit /b %ERRORLEVEL%
+				if not defined %%~f_done (
+					set %%~f_done=1
+					call :prime_download %%e %%~f %%~g || goto :eof
+				)
+			)
+		)
+
+		for /f "usebackq tokens=1,2,3* delims=[]=" %%e in (`set  [%%a[`) do (
+			if not defined %%~f_done (
+				echo ^> Cannot find key '%%~f'
+				exit /b 1
 			)
 		)
 		set wsections=%%b

@@ -116,10 +126,11 @@ setlocal EnableDelayedExpansion
 		if ERRORLEVEL 1 exit /b !ERRORLEVEL!
 	)
 
+
 	for %%x in (%MOR_EXTS_TAR%) do (
 		if "!ext!"=="%%x" (
 			call :unzip_archive !current_target_dir! %1 !ext!
-			if ERRORLEVEL 1 exit /b %ERRORLEVEL%
+			if ERRORLEVEL 1 exit /b !ERRORLEVEL!
 			goto :MOR_AFTER_EXTRACT
 		)
 	)
diff --git a/requirements.ini b/requirements.ini
@@ -3,21 +3,29 @@
 mor=https://github.com
 
 [#lib]
+/=testing secondtest
+
+[#badlib]
 /=precompiled newli
 
 [@lib]
 test1=0.1
 test2=0.3
 
+[@badlib]
+test1=0.1
+test2=0.3
+
 [badlink]
 something-3.3=https://getsh.org/wrong
 
 [testing]
 ;libfoo-2.7=https://github.com/protocolbuffers/protobuf/releases/download/v26.1/protoc-26.1-osx-aarch_64.zip
 test1-0.1=https://getsh.org/index.html
-test2-0.1=https://getsh.org/bharatvaj/pubkey.asc
+test2-0.3=https://getsh.org/bharatvaj/pubkey.asc
 
 [secondtest]
+test1-0.2=https://getsh.org/index.html
 test1-45=https://google.com/
 
 [newli]