-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathscan_docs.cmd
74 lines (63 loc) · 1.78 KB
/
scan_docs.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
@echo off
setlocal EnableDelayedExpansion
pushd %~dp0
rem Set needed environment variables.
set SCAN_DOCS_SCRIPT_DIRECTORY=%~dp0
rem Look for options on the command line.
set MY_VERBOSE=
:process_arguments
if "%1" == "-h" (
echo Command: %0 [options]
echo Usage:
echo - Scan the help documentation for the project.
echo Options:
echo -h This message.
echo -v Display verbose information.
GOTO real_end
) else if "%1" == "-v" (
set MY_VERBOSE=--verbose
) else if "%1" == "" (
goto after_process_arguments
) else (
echo Argument '%1' not understood. Stopping.
echo Type '%0 -h' to see valid arguments.
goto error_end
)
shift
goto process_arguments
:after_process_arguments
rem Announce what this script does.
echo {Scanning the documentation directory for warnings.}
rem Cleanly start the main part of the script
if defined MY_VERBOSE (
echo {Scanning the documentation using PyMarkdown.}
)
pipenv run python main.py --config %SCAN_DOCS_SCRIPT_DIRECTORY%\newdocs\clean.json scan -r %SCAN_DOCS_SCRIPT_DIRECTORY%\newdocs\src
if ERRORLEVEL 1 (
echo.
echo {Scanning the documentation using PyMarkdown failed.}
goto error_end
)
@REM if defined MY_VERBOSE (
@REM echo {Reformatting the documentation using MdFormat.}
@REM )
@REM pipenv run mdformat --align-semantic-breaks-in-lists --end-of-line keep --wrap 80 .
@REM if ERRORLEVEL 1 (
@REM echo.
@REM echo {Reformatting the documentation using MdFormat failed.}
@REM goto error_end
@REM )
rem Cleanly exit the script
:good_end
echo.
set PC_EXIT_CODE=0
if defined MY_VERBOSE (
echo {Scanning the documentation directory succeeded.}
)
goto real_end
:error_end
set PC_EXIT_CODE=1
echo {Scanning the documentation directory failed.}
:real_end
popd
exit /B %PC_EXIT_CODE%