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.ps1script contained multiple references tobuild.ps1in its help documentation:UnblockFile .\build.ps1→UnblockFile .\update.ps1.\build.ps1and.\build -verbose→.\update.ps1and.\update.ps1 -verbose2. Inconsistent Project URL References
Scripts were using different URLs in their help documentation:
pack.ps1used:https://github.com/cmderdev/cmderbuild.ps1andupdate.ps1used:http://cmder.app/All scripts now consistently reference the GitHub project URL.
3. Variable Naming Inconsistencies
The codebase had mixed usage of
$cmder_rootvs$cmderRoot. Standardized on$cmder_root(underscore notation) for consistency across all scripts while preserving the$cmderRootparameter inpack.ps1for backward compatibility.4. Error Handling Pattern Inconsistencies
Some utility functions used
Write-Errorfollowed byexit 1while others usedthrowstatements. Updated theEnsure-ExistsandEnsure-Executablefunctions to usethrowfor consistency with PowerShell best practices and the rest of the codebase.5. Additional Documentation Fix
Fixed an inconsistent example in
build.ps1that showed.\build -verboseinstead 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.