Skip to content

Commit a42e10d

Browse files
Updated docblocks
1 parent a5280eb commit a42e10d

File tree

1 file changed

+69
-50
lines changed

1 file changed

+69
-50
lines changed

cli_changer.bat

Lines changed: 69 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ rem +------------------------------------------------+
1515
rem | DO NOT EDIT BELOW THIS LINE |
1616
rem +------------------------------------------------+
1717

18-
rem ---------------------
19-
rem Default Variables
20-
rem ---------------------
18+
rem -------------------
19+
rem Default Variables
20+
rem -------------------
2121
set $scriptVersion=1.3.0
2222

2323
set $defaultInstallPath[0]=C:\wamp
@@ -34,9 +34,9 @@ set $colorWarning=0E
3434
set $colorFailure=0C
3535

3636

37-
rem --------------------
38-
rem Operation By CLI
39-
rem --------------------
37+
rem ------------------
38+
rem Operation By CLI
39+
rem ------------------
4040

4141
rem Check if the CLI is being used.
4242
if "%1" neq "" (
@@ -52,9 +52,10 @@ if "%1" neq "" (
5252
)
5353
)
5454

55-
rem --------------------
56-
rem Operation by TUI
57-
rem --------------------
55+
56+
rem ------------------
57+
rem Operation by TUI
58+
rem ------------------
5859

5960
rem Check if the TUI is being used.
6061
if %$cliMode% equ 0 (
@@ -64,9 +65,9 @@ if %$cliMode% equ 0 (
6465
)
6566

6667

67-
rem -----------------
68-
rem Install Paths
69-
rem -----------------
68+
rem ---------------
69+
rem Install Paths
70+
rem ---------------
7071

7172
rem Test for a custom install path.
7273
if defined $customInstallPath (
@@ -99,9 +100,9 @@ rem Exit if unable to find installation path.
99100
if not defined $installPath goto defaultInstallPathsMissing
100101

101102

102-
rem -------------------
103-
rem PHP Folder Path
104-
rem -------------------
103+
rem -----------------
104+
rem PHP Folder Path
105+
rem -----------------
105106

106107
rem Set the path to the PHP folders.
107108
if %$installPath:~-1% neq \ (
@@ -125,9 +126,9 @@ rem Set the last available PHP versions array id.
125126
set $lastAvailablePhpVersionsArrayId=!counter!
126127

127128

128-
rem ----------------------------
129-
rem Users Environmental Path
130-
rem ----------------------------
129+
rem --------------------------
130+
rem Users Environmental Path
131+
rem --------------------------
131132

132133
rem Get the users environmental path string.
133134
for /F "usebackq tokens=2,*" %%a in (`reg.exe query HKCU\Environment /v PATH`) do (
@@ -150,9 +151,9 @@ rem Set the last users environmental path array id.
150151
set $lastUsersEnvironmentalPathArrayId=!counter!
151152

152153

153-
rem ----------------------------
154-
rem Match PHP Folder Version
155-
rem ----------------------------
154+
rem --------------------------
155+
rem Match PHP Folder Version
156+
rem --------------------------
156157

157158
rem If there is more than one PHP path in the users environmental path, the operating system
158159
rem will only use the first one. Therefore, we only need to match the first one.
@@ -177,9 +178,9 @@ for /L %%a in (1,1,%$lastUsersEnvironmentalPathArrayId%) do (
177178
:break
178179

179180

180-
rem --------------------
181-
rem Operation By CLI
182-
rem --------------------
181+
rem ------------------
182+
rem Operation By CLI
183+
rem ------------------
183184

184185
rem Check if the CLI is being used.
185186
if %$cliMode% equ 1 (
@@ -201,17 +202,17 @@ if %$cliMode% equ 1 (
201202
)
202203

203204

204-
rem -----------
205-
rem Hack(s)
206-
rem -----------
205+
rem ---------
206+
rem Hack(s)
207+
rem ---------
207208

208209
rem Hack to define a backspace so the 'set /p' command can be offset from the windows edge.
209210
for /F %%a in ('"prompt $H &echo on &for %%b in (1) do rem"') do set backspace=%%a
210211

211212

212-
rem ------------------------
213-
rem Display PHP Versions
214-
rem ------------------------
213+
rem ----------------------
214+
rem Display PHP Versions
215+
rem ----------------------
215216

216217
rem Show the header.
217218
echo:
@@ -236,9 +237,9 @@ set /p $newSelectionId=%backspace% Selection (1-%$lastAvailablePhpVersionsArray
236237
echo:
237238

238239

239-
rem --------------------
240-
rem Check User Input
241-
rem --------------------
240+
rem ------------------
241+
rem Check User Input
242+
rem ------------------
242243
:checkUserInput
243244

244245
rem Check if the new selection comprises of digits.
@@ -252,10 +253,10 @@ rem Check if the new selection is the same as the current selection.
252253
if %$newSelectionId% equ %$currentPhpVersionId% goto currentSelectionGiven
253254

254255

255-
rem ---------------------------------
256-
rem Update Users Environment Path
257-
rem TODO: Does this need to move down into is own block / function as well?
258-
rem ---------------------------------
256+
rem -------------------------------
257+
rem Update Users Environment Path
258+
rem TODO: Does this need to move down into is own block / function as well?
259+
rem -------------------------------
259260

260261
rem Rebuild the users environmental path string excluding any and all previously
261262
rem set PHP folder paths no matter where they are located within the string.
@@ -290,9 +291,9 @@ rem: TODO: move down into setx path code block.
290291
set $usersEnvironmentalPathString=%$usersEnvironmentalPathString%%$pathToPhpFolders%\!$availablePhpVersionsArray[%$newSelectionId%]!
291292

292293

293-
rem -------------------------------------------
294-
rem Perform action depending on entry point
295-
rem -------------------------------------------
294+
rem -----------------------------------------
295+
rem Perform action depending on entry point
296+
rem -----------------------------------------
296297

297298
rem Check if the CLI session mode is being used.
298299
if %$cliSessionMode% equ 1 (
@@ -346,13 +347,17 @@ rem Explode the environmental path string.
346347
exit /B
347348

348349

349-
rem Implode the environmental path string (whilst excluding any PHP versions).
350-
:implodeEnvironmentalPathExcludingPhps
350+
rem ----------------------------
351+
rem Implode path excluding PHP
352+
rem ----------------------------
353+
:implodePathExcludingPhps
351354

352355
exit /B
353356

354357

355-
rem Add the selected PHP path to environmental path string.
358+
rem ---------------------------
359+
rem Include selected PHP path
360+
rem ---------------------------
356361
:includeSelectedPhpPath
357362

358363
exit /B
@@ -362,7 +367,9 @@ rem ============================================================================
362367
rem Success Message
363368
rem ====================================================================================================================
364369

365-
rem The update was successful.
370+
rem -------------------
371+
rem Update successful
372+
rem -------------------
366373
:updateSuccessful
367374

368375
if %$cliMode% equ 0 (
@@ -378,7 +385,9 @@ if %$cliMode% equ 0 (
378385
)
379386

380387

381-
rem The 'session' update was successful.
388+
rem ---------------------------
389+
rem Session update successful
390+
rem ---------------------------
382391
:sessionUpdateSuccessful
383392

384393
echo Success: This sessions PHP CLI version is now !$availablePhpVersionsArray[%$newSelectionId%]!
@@ -390,7 +399,9 @@ rem ============================================================================
390399
rem Notice Message
391400
rem ====================================================================================================================
392401

393-
rem A current selection was given.
402+
rem -------------------------
403+
rem Current selection given
404+
rem -------------------------
394405
:currentSelectionGiven
395406

396407
if %$cliMode% equ 0 (
@@ -410,7 +421,9 @@ rem ============================================================================
410421
rem Failure Message
411422
rem ====================================================================================================================
412423

413-
rem An invalid selection was given.
424+
rem -------------------------
425+
rem Invalid selection given
426+
rem -------------------------
414427
:invalidSelectionGiven
415428

416429
if %$cliMode% equ 0 (
@@ -430,7 +443,9 @@ rem ============================================================================
430443
rem Error Messages
431444
rem ====================================================================================================================
432445

433-
rem An invalid $customInstallPath was given.
446+
rem -----------------------------------
447+
rem Invalid custom install path given
448+
rem -----------------------------------
434449
:invalidCustomInstallPathGiven
435450

436451
if %$cliMode% equ 0 (
@@ -447,7 +462,9 @@ if %$cliMode% equ 0 (
447462
)
448463

449464

450-
rem Both of the default install paths are missing.
465+
rem -------------------------------
466+
rem Default install paths missing
467+
rem -------------------------------
451468
:defaultInstallPathsMissing
452469
if %$cliMode% equ 0 (
453470
color %$colorFailure%
@@ -471,7 +488,9 @@ if %$cliMode% equ 0 (
471488
)
472489

473490

474-
rem An invalid $pathToPhpFolders was given.
491+
rem ----------------------------------
492+
rem Invalid path to PHP folder given
493+
rem ----------------------------------
475494
:invalidPathToPhpFoldersGiven
476495

477496
if %$cliMode% equ 0 (

0 commit comments

Comments
 (0)