Spack on Windows: spack.bat comment syntax (#36531)

Comments must start with `rem` in most cases.
This commit is contained in:
John W. Parent 2023-04-06 12:43:27 -04:00 committed by GitHub
parent 685dd7272a
commit 44e15da92c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -60,28 +60,28 @@ setlocal enabledelayedexpansion
:: capture cl args in variable named cl_args :: capture cl args in variable named cl_args
set cl_args=%* set cl_args=%*
:process_cl_args :process_cl_args
:: tokens=1* returns the first processed token produced rem tokens=1* returns the first processed token produced
:: by tokenizing the input string cl_args on spaces into rem by tokenizing the input string cl_args on spaces into
:: the named variable %%g rem the named variable %%g
:: While this make look like a for loop, it only rem While this make look like a for loop, it only
:: executes a single time for each of the cl args rem executes a single time for each of the cl args
:: the actual iterative loop is performed by the rem the actual iterative loop is performed by the
:: goto process_cl_args stanza rem goto process_cl_args stanza
:: we are simply leveraging the "for" method's string rem we are simply leveraging the "for" method's string
:: tokenization rem tokenization
for /f "tokens=1*" %%g in ("%cl_args%") do ( for /f "tokens=1*" %%g in ("%cl_args%") do (
set t=%%~g set t=%%~g
:: remainder of string is composed into %%h rem remainder of string is composed into %%h
:: these are the cl args yet to be processed rem these are the cl args yet to be processed
:: assign cl_args var to only the args to be processed rem assign cl_args var to only the args to be processed
:: effectively discarding the current arg %%g rem effectively discarding the current arg %%g
:: this will be nul when we have no further tokens to process rem this will be nul when we have no further tokens to process
set cl_args=%%h set cl_args=%%h
:: process the first space delineated cl arg rem process the first space delineated cl arg
:: of this iteration rem of this iteration
if "!t:~0,1!" == "-" ( if "!t:~0,1!" == "-" (
if defined _sp_subcommand ( if defined _sp_subcommand (
:: We already have a subcommand, processing args now rem We already have a subcommand, processing args now
if not defined _sp_args ( if not defined _sp_args (
set "_sp_args=!t!" set "_sp_args=!t!"
) else ( ) else (
@ -109,8 +109,8 @@ for /f "tokens=1*" %%g in ("%cl_args%") do (
) )
) )
) )
:: if this is not nil, we have more tokens to process rem if this is not nil, we have more tokens to process
:: start above process again with remaining unprocessed cl args rem start above process again with remaining unprocessed cl args
if defined cl_args goto :process_cl_args if defined cl_args goto :process_cl_args