2018-03-23 22:20:07 +08:00
|
|
|
|
@echo off
|
|
|
|
|
|
|
|
|
|
call "%~dp0lib_base.cmd"
|
|
|
|
|
set lib_console=call "%~dp0lib_console.cmd"
|
2022-10-18 20:50:30 +08:00
|
|
|
|
set ESC=
|
2018-03-23 22:20:07 +08:00
|
|
|
|
|
2020-12-08 03:41:11 +08:00
|
|
|
|
:: Much faster than using "%lib_console% debug_output ..." etc.
|
2020-12-10 21:35:40 +08:00
|
|
|
|
set print_debug=if %debug_output% gtr 0 %lib_console% debug_output
|
|
|
|
|
set print_verbose=if %verbose_output% gtr 0 %lib_console% verbose_output
|
|
|
|
|
set print_error=%lib_console% show_error
|
2020-12-08 03:41:11 +08:00
|
|
|
|
|
2020-06-27 10:27:29 +08:00
|
|
|
|
if "%fast_init%" == "1" exit /b
|
|
|
|
|
|
2018-03-23 22:20:07 +08:00
|
|
|
|
if "%~1" == "/h" (
|
2018-05-31 20:35:02 +08:00
|
|
|
|
%lib_base% help "%~0"
|
2018-03-23 22:20:07 +08:00
|
|
|
|
) else if "%1" neq "" (
|
|
|
|
|
call :%*
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
exit /b
|
|
|
|
|
|
2018-09-02 11:08:00 +08:00
|
|
|
|
:debug_output
|
2018-03-23 22:20:07 +08:00
|
|
|
|
:::===============================================================================
|
2018-09-02 11:08:00 +08:00
|
|
|
|
:::debug_output - Output a debug message to the console.
|
2018-03-23 22:20:07 +08:00
|
|
|
|
:::.
|
|
|
|
|
:::include:
|
|
|
|
|
:::.
|
2018-05-31 20:35:02 +08:00
|
|
|
|
::: call "lib_console.cmd"
|
2018-03-23 22:20:07 +08:00
|
|
|
|
:::.
|
|
|
|
|
:::usage:
|
|
|
|
|
:::.
|
2018-09-02 11:08:00 +08:00
|
|
|
|
::: %lib_console% debug_output [caller] [message]
|
2018-03-23 22:20:07 +08:00
|
|
|
|
:::.
|
|
|
|
|
:::required:
|
|
|
|
|
:::.
|
2018-09-02 11:08:00 +08:00
|
|
|
|
::: [caller] <in> Script/sub routine name calling debug_output
|
2018-03-23 22:20:07 +08:00
|
|
|
|
:::.
|
|
|
|
|
::: [message] <in> Message text to display.
|
|
|
|
|
:::.
|
|
|
|
|
:::-------------------------------------------------------------------------------
|
|
|
|
|
|
2018-09-02 11:08:00 +08:00
|
|
|
|
if %debug_output% gtr 0 echo DEBUG(%~1): %~2 & echo.
|
2018-03-23 22:20:07 +08:00
|
|
|
|
exit /b
|
|
|
|
|
|
2018-09-02 11:08:00 +08:00
|
|
|
|
:verbose_output
|
2018-03-23 22:20:07 +08:00
|
|
|
|
:::===============================================================================
|
2018-09-02 11:08:00 +08:00
|
|
|
|
:::verbose_output - Output a debug message to the console.
|
2018-03-23 22:20:07 +08:00
|
|
|
|
:::.
|
|
|
|
|
:::include:
|
|
|
|
|
:::.
|
|
|
|
|
::: call "$0"
|
|
|
|
|
:::.
|
|
|
|
|
:::usage:
|
|
|
|
|
:::.
|
2018-09-02 11:08:00 +08:00
|
|
|
|
::: %lib_console% verbose_output "[message]"
|
2018-03-23 22:20:07 +08:00
|
|
|
|
:::.
|
|
|
|
|
:::required:
|
|
|
|
|
:::.
|
|
|
|
|
::: [message] <in> Message text to display.
|
|
|
|
|
:::.
|
|
|
|
|
:::-------------------------------------------------------------------------------
|
|
|
|
|
|
2018-09-02 11:08:00 +08:00
|
|
|
|
if %verbose_output% gtr 0 echo %~1
|
2018-03-23 22:20:07 +08:00
|
|
|
|
exit /b
|
|
|
|
|
|
|
|
|
|
:show_error
|
|
|
|
|
:::===============================================================================
|
|
|
|
|
:::show_error - Output an error message to the console.
|
|
|
|
|
:::.
|
|
|
|
|
:::include:
|
|
|
|
|
:::.
|
|
|
|
|
::: call "$0"
|
|
|
|
|
:::.
|
|
|
|
|
:::usage:
|
|
|
|
|
:::.
|
|
|
|
|
::: %lib_console% show_error "[message]"
|
|
|
|
|
:::.
|
|
|
|
|
:::required:
|
|
|
|
|
:::.
|
|
|
|
|
::: [message] <in> Message text to display.
|
|
|
|
|
:::.
|
|
|
|
|
:::-------------------------------------------------------------------------------
|
|
|
|
|
|
2022-10-18 20:50:30 +08:00
|
|
|
|
echo %ESC%[91;1mERROR:%ESC%[0m %~1
|
2018-03-23 22:20:07 +08:00
|
|
|
|
exit /b
|