mirror of
https://github.com/cmderdev/cmder.git
synced 2025-06-16 22:57:49 +08:00
Made all sub-routines in init.bat importable libs (#1706)
This commit is contained in:
48
vendor/lib/lib_base.cmd
vendored
Normal file
48
vendor/lib/lib_base.cmd
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
@echo off
|
||||
|
||||
set lib_base=call "%~dp0lib_base.cmd"
|
||||
|
||||
if "%~1" == "/h" (
|
||||
%lib_base% help "%0"
|
||||
) else if "%1" neq "" (
|
||||
call :%*
|
||||
)
|
||||
|
||||
exit /b
|
||||
|
||||
:help
|
||||
:::===============================================================================
|
||||
:::show_subs - shows all sub routines in a .bat/.cmd file with documentation
|
||||
:::.
|
||||
:::include:
|
||||
:::.
|
||||
::: call "$0"
|
||||
:::.
|
||||
:::usage:
|
||||
:::.
|
||||
::: %lib_base% show_subs "file"
|
||||
:::.
|
||||
:::options:
|
||||
:::.
|
||||
::: file <in> full path to file containing lib_routines to display
|
||||
:::.
|
||||
:::-------------------------------------------------------------------------------
|
||||
|
||||
for /f "tokens=* delims=:" %%a in ('type "%~1" ^| findstr /i /r "^:::"') do (
|
||||
rem echo a="%%a"
|
||||
|
||||
if "%%a"==" " (
|
||||
echo.
|
||||
if "%%a"=="." (
|
||||
echo.
|
||||
) else if /i "%%a" == "usage" (
|
||||
echo %%a:
|
||||
) else if /i "%%a" == "options" (
|
||||
echo %%a:
|
||||
) else if not "%%a" == "" (
|
||||
echo %%a
|
||||
)
|
||||
)
|
||||
|
||||
pause
|
||||
exit /b
|
Reference in New Issue
Block a user