From edc2994eb1c0ec0e54c72a98e03081f97c12d211 Mon Sep 17 00:00:00 2001 From: ablejec Date: Sat, 17 Nov 2018 19:05:54 +0100 Subject: [PATCH] display metedata in two columns --- Templates/makeAssay.bat | 25 +++++++++++++++++++------ Templates/makeInvestigation.bat | 24 +++++++++++++++++++----- Templates/makeStudy.bat | 30 +++++++++++++++++++++++++++--- makeProject.bat | 30 +++++++++++++++++++++++++++--- 4 files changed, 92 insertions(+), 17 deletions(-) diff --git a/Templates/makeAssay.bat b/Templates/makeAssay.bat index d7e0554..56a7d13 100644 --- a/Templates/makeAssay.bat +++ b/Templates/makeAssay.bat @@ -320,10 +320,9 @@ rem type README.MD rem dir . cls echo ====================================== -echo Assay METADATA +echo Assay METADATA echo ====================================== -rem call:showDesc %descFile% -type %descFile% +call:showDesc %descFile% cd .. rem copy existing files from nonversioned tree (if any) rem robocopy X-%ID% %ID% /E @@ -879,7 +878,21 @@ rem ------------------------------------------------------------------- :: :: Example: call:showDesc %descFile% :: -setlocal -For /F "TOKENS=1,2" %%A In (%~1) echo %%A %%B +SETLOCAL EnableDelayedExpansion +For /F "TOKENS=1-2 delims= " %%A In (%~1) do ( + call:showTwoCol "%%A" "%%B" + ) endlocal -goto :EOF \ No newline at end of file +goto :EOF +rem ------------------------------------------------------------------- +:showTwoCol --- show one line +:: --- %~1 first column +:: --- %~2 second column +:: +:: Example: call:showTwoCol "Item name" "Item value" +:: + set "_sp= " + set "iname=%~1%_sp%" + set "iname=%iname:~0,30%" + echo %iname% %~2 +goto:eof diff --git a/Templates/makeInvestigation.bat b/Templates/makeInvestigation.bat index d54b956..903d13e 100644 --- a/Templates/makeInvestigation.bat +++ b/Templates/makeInvestigation.bat @@ -126,9 +126,9 @@ copy ..\common.ini . /b > NUL rem Display metadata cls echo ====================================== -echo Investigation METADATA +echo Investigation METADATA echo ====================================== -type %descFile% +call:showDesc %descFile% cd .. rem copy existing files from nonversioned tree (if any) rem robocopy X-%ID% %ID% /E @@ -355,7 +355,21 @@ rem ------------------------------------------------------------------- :: :: Example: call:showDesc %descFile% :: -setlocal -For /F "TOKENS=1,2" %%A In (%~1) echo %%A %%B +SETLOCAL EnableDelayedExpansion +For /F "TOKENS=1-2 delims= " %%A In (%~1) do ( + call:showTwoCol "%%A" "%%B" + ) endlocal -goto :EOF \ No newline at end of file +goto :EOF +rem ------------------------------------------------------------------- +:showTwoCol --- show one line +:: --- %~1 first column +:: --- %~2 second column +:: +:: Example: call:showTwoCol "Item name" "Item value" +:: + set "_sp= " + set "iname=%~1%_sp%" + set "iname=%iname:~0,30%" + echo %iname% %~2 +goto:eof diff --git a/Templates/makeStudy.bat b/Templates/makeStudy.bat index 282804c..5ad0fab 100644 --- a/Templates/makeStudy.bat +++ b/Templates/makeStudy.bat @@ -100,9 +100,9 @@ copy ..\common.ini . /b > NUL rem Display metadata cls echo ====================================== -echo Study METADATA +echo Study METADATA echo ====================================== -type %descFile% +call:showDesc %descFile% cd .. rem copy existing files from nonversioned tree (if any) rem robocopy X-%ID% %ID% /E @@ -272,4 +272,28 @@ setlocal enableextensions disabledelayedexpansion rem echo Selected file is "%my_file%" (endlocal set "%~2=%my_file%") -goto :eof \ No newline at end of file +goto :eof +rem ------------------------------------------------------------------- +:showDesc --- show description file in columns +:: --- %~1 file name +:: +:: Example: call:showDesc %descFile% +:: +SETLOCAL EnableDelayedExpansion +For /F "TOKENS=1-2 delims= " %%A In (%~1) do ( + call:showTwoCol "%%A" "%%B" + ) +endlocal +goto :EOF +rem ------------------------------------------------------------------- +:showTwoCol --- show one line +:: --- %~1 first column +:: --- %~2 second column +:: +:: Example: call:showTwoCol "Item name" "Item value" +:: + set "_sp= " + set "iname=%~1%_sp%" + set "iname=%iname:~0,30%" + echo %iname% %~2 +goto:eof diff --git a/makeProject.bat b/makeProject.bat index 509d5aa..07800e4 100644 --- a/makeProject.bat +++ b/makeProject.bat @@ -95,9 +95,9 @@ copy ..\common.ini . /b > NUL rem Display metadata cls echo ====================================== -echo project METADATA +echo project METADATA echo ====================================== -type %descFile% +call:showDesc %descFile% cd.. rem copy existing files from nonversioned tree (if any) rem robocopy X-%ID% %ID% /E @@ -282,4 +282,28 @@ setlocal enableextensions disabledelayedexpansion rem echo Selected file is "%my_file%" (endlocal set "%~2=%my_file%") -goto :eof \ No newline at end of file +goto :eof +rem ------------------------------------------------------------------- +:showDesc --- show description file in columns +:: --- %~1 file name +:: +:: Example: call:showDesc %descFile% +:: +SETLOCAL EnableDelayedExpansion +For /F "TOKENS=1-2 delims= " %%A In (%~1) do ( + call:showTwoCol "%%A" "%%B" + ) +endlocal +goto :EOF +rem ------------------------------------------------------------------- +:showTwoCol --- show one line +:: --- %~1 first column +:: --- %~2 second column +:: +:: Example: call:showTwoCol "Item name" "Item value" +:: + set "_sp= " + set "iname=%~1%_sp%" + set "iname=%iname:~0,30%" + echo %iname% %~2 +goto:eof