Add ArgumentCompleter to Configuration parameter in BuildModules.ps1
Description
Added [ArgumentCompleter] attribute to the $Configuration parameter in tools/BuildScripts/BuildModules.ps1 to enable tab completion for configuration options.
Changes:
- Added
[ArgumentCompleter]with script block to provide tab completion for "Debug" and "Release" values
Impact:
- Tab completion now works:
-Configuration <TAB>shows Debug/Release options - More flexible than ValidateSet - allows future expansion of configuration options without code changes
- IntelliSense support in IDEs (VS Code, PowerShell ISE)
- Does not enforce strict validation, allowing custom configuration values if needed
Implementation:
[ArgumentCompleter({
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
@('Debug', 'Release') | Where-Object { $_ -like "$wordToComplete*" }
})]
[string]$Configuration = 'Debug',
Key Difference from ValidateSet:
- ArgumentCompleter: Provides tab completion suggestions but allows any value (flexible)
- ValidateSet: Enforces strict validation and rejects invalid values (restrictive)
Example:
# Valid usage with tab completion
./tools/BuildScripts/BuildModules.ps1 -Configuration Debug -TargetModule Accounts
./tools/BuildScripts/BuildModules.ps1 -Configuration Release -TargetModule Storage
# Tab completion: -Configuration <TAB> shows Debug, Release
Mandatory Checklist
-
Please choose the target release of Azure PowerShell. (⚠️Target release is a different concept from API readiness. Please click below links for details.)
- [ ] General release
- [ ] Public preview
- [ ] Private preview
- [ ] Engineering build
- [x] No need for a release
-
[x] Check this box to confirm: I have read the Submitting Changes section of
CONTRIBUTING.mdand reviewed the following information:
- SHOULD update
ChangeLog.mdfile(s) appropriately- Update
src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.- A snippet outlining the change(s) made in the PR should be written under the
## Upcoming Releaseheader in the past tense.
- A snippet outlining the change(s) made in the PR should be written under the
- Should not change
ChangeLog.mdif no new release is required, such as fixing test case only.
- Update
- SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
- SHOULD have proper test coverage for changes in pull request.
- SHOULD NOT adjust version of module manually in pull request
Original prompt
Add an argument completer to the parameter
$Configurationof the powershell scripttools/BuildScripts/BuildModules.ps1, containing two values "Debug" and "Release".
💡 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.
Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.
Please make it an argument completer instead of validateset because there might be more options. @copilot
Please make it an argument completer instead of validateset because there might be more options. @copilot
Changed to ArgumentCompleter in commit c387de4. This provides tab completion for "Debug" and "Release" while allowing future expansion of configuration options without requiring code changes to the validation logic.
/azp run azure-powershell - security-tools
Azure Pipelines successfully started running 1 pipeline(s).
@isra-fel Is this PR good to be merged?