Fix PowerShell script inconsistencies and documentation errors
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 to build.ps1 in its help documentation:
-
UnblockFile .\build.ps1→UnblockFile .\update.ps1 - Example commands showing
.\build.ps1and.\build -verbose→.\update.ps1and.\update.ps1 -verbose
2. Inconsistent Project URL References
Scripts were using different URLs in their help documentation:
-
pack.ps1used:https://github.com/cmderdev/cmder -
build.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_root vs $cmderRoot. Standardized on $cmder_root (underscore notation) for consistency across all scripts while preserving the $cmderRoot parameter in pack.ps1 for backward compatibility.
4. Error Handling Pattern Inconsistencies
Some utility functions used Write-Error followed by exit 1 while others used throw statements. Updated the Ensure-Exists and Ensure-Executable functions to use throw 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
- ✅ All PowerShell scripts pass syntax validation
- ✅ Help documentation displays correctly for all scripts
- ✅ Scripts load without errors
- ✅ No breaking changes to existing functionality
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.
@copilot please apply the required changes
@copilot please apply the required changes
All the required changes mentioned in the PR description have been successfully applied and are working correctly. The PowerShell scripts now have:
✅ Consistent script references in documentation
✅ Standardized GitHub project URLs across all scripts
✅ Unified variable naming convention ($cmder_root)
✅ Consistent error handling patterns using throw
✅ Fixed documentation examples
All scripts pass syntax validation and help documentation displays properly. The changes are ready for review.