Fix PowerShell script inconsistencies and documentation errors #3015
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses several inconsistencies in the PowerShell scripts within the
scripts/
folder that were causing confusion for developers and reducing code maintainability.Issues Fixed
1. Incorrect Script References in Help Documentation
The
update.ps1
script contained multiple references tobuild.ps1
in its help documentation:UnblockFile .\build.ps1
→UnblockFile .\update.ps1
.\build.ps1
and.\build -verbose
→.\update.ps1
and.\update.ps1 -verbose
2. Inconsistent Project URL References
Scripts were using different URLs in their help documentation:
pack.ps1
used:https://github.com/cmderdev/cmder
build.ps1
andupdate.ps1
used:http://cmder.app/
All scripts now consistently reference the GitHub project URL.
3. Variable Naming Inconsistencies
The codebase had mixed usage of
$cmder_root
vs$cmderRoot
. Standardized on$cmder_root
(underscore notation) for consistency across all scripts while preserving the$cmderRoot
parameter inpack.ps1
for backward compatibility.4. Error Handling Pattern Inconsistencies
Some utility functions used
Write-Error
followed byexit 1
while others usedthrow
statements. Updated theEnsure-Exists
andEnsure-Executable
functions to usethrow
for consistency with PowerShell best practices and the rest of the codebase.5. Additional Documentation Fix
Fixed an inconsistent example in
build.ps1
that showed.\build -verbose
instead of.\build.ps1 -verbose
.Testing
The changes are minimal and surgical, focusing only on consistency improvements without altering core functionality.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.