Skip to content

Enhance PowerShell switch parameter guidance and examples#1091

Closed
time-by-waves wants to merge 9 commits into
github:stagedfrom
time-by-waves:main
Closed

Enhance PowerShell switch parameter guidance and examples#1091
time-by-waves wants to merge 9 commits into
github:stagedfrom
time-by-waves:main

Conversation

@time-by-waves
Copy link
Copy Markdown
Contributor

@time-by-waves time-by-waves commented Mar 19, 2026

Pull Request Checklist

  • I have read and followed the CONTRIBUTING.md guidelines.
  • I have read and followed the Guidance for submissions involving paid services.
  • My contribution adds a new instruction, prompt, agent, skill, or workflow file in the correct directory.
  • The file follows the required naming convention.
  • The content is clearly structured and follows the example format.
  • I have tested my instructions, prompt, agent, skill, or workflow with GitHub Copilot.
  • I have run npm start and verified that README.md is up to date.

Description

Error Handling

  • Update to the powershell.instructions.md file. Now includes less error handling in the examples. This means when using the instructions file the output script contains less of the structured error handling, however the output scripts are easier for beginners and powershell novices to read and understand.

Switch parameter

  • Updates to using the switch parameters should now prevent default values data type being a bool
  • Using no default value is the way in PowerShell. Defaults to a false value and shouldn't be set to a true value. Although a note has been added to show the correct syntax that requires type casting

Examples updates

  • Now includes a better demonstration of using the WhatIf parameter via $PSCmdlet.ShouldProcesss
  • Full Example: End-to-End Cmdlet Pattern updated with the $Force & $PSCmdlet.ShouldContinue pattern

Type of Contribution

  • New instruction file.
  • New prompt file.
  • New agent file.
  • New plugin.
  • New skill file.
  • New agentic workflow.
  • Update to existing instruction, prompt, agent, plugin, skill, or workflow.
  • Other (please specify):

Additional Notes

I've tested the new instructions for a few months on and off. Many different models have been used, and I'm happier with the generated results of these instructions.


By submitting this pull request, I confirm that my contribution abides by the Code of Conduct and will be licensed under the MIT License.

github-actions Bot and others added 9 commits March 9, 2026 06:01
…an parameters (#2)

* Initial plan

* Enhanced PowerShell switch parameter guidance with anti-patterns

Co-authored-by: time-by-waves <34587654+time-by-waves@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Address review feedback: simplify guidance, merge examples, add ShouldContinue

Co-authored-by: time-by-waves <34587654+time-by-waves@users.noreply.github.com>

* Clarify switch default value syntax in example comment

Co-authored-by: time-by-waves <34587654+time-by-waves@users.noreply.github.com>

* Simplify Error Handling example and clarify switch syntax comment

Co-authored-by: time-by-waves <34587654+time-by-waves@users.noreply.github.com>

* Replace Show-Process with Show-FileInfo to avoid cmdlet name confusion

Co-authored-by: time-by-waves <34587654+time-by-waves@users.noreply.github.com>

* Remove usage comments from Error Handling example

Co-authored-by: time-by-waves <34587654+time-by-waves@users.noreply.github.com>

* Remove inappropriate ConfirmImpact from read-only operation

Co-authored-by: time-by-waves <34587654+time-by-waves@users.noreply.github.com>

* Change example to destructive operation with appropriate ConfirmImpact

Co-authored-by: time-by-waves <34587654+time-by-waves@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: time-by-waves <34587654+time-by-waves@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…an parameters (#2)

* Initial plan

* Enhanced PowerShell switch parameter guidance with anti-patterns

Co-authored-by: time-by-waves <34587654+time-by-waves@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Address review feedback: simplify guidance, merge examples, add ShouldContinue

Co-authored-by: time-by-waves <34587654+time-by-waves@users.noreply.github.com>

* Clarify switch default value syntax in example comment

Co-authored-by: time-by-waves <34587654+time-by-waves@users.noreply.github.com>

* Simplify Error Handling example and clarify switch syntax comment

Co-authored-by: time-by-waves <34587654+time-by-waves@users.noreply.github.com>

* Replace Show-Process with Show-FileInfo to avoid cmdlet name confusion

Co-authored-by: time-by-waves <34587654+time-by-waves@users.noreply.github.com>

* Remove usage comments from Error Handling example

Co-authored-by: time-by-waves <34587654+time-by-waves@users.noreply.github.com>

* Remove inappropriate ConfirmImpact from read-only operation

Co-authored-by: time-by-waves <34587654+time-by-waves@users.noreply.github.com>

* Change example to destructive operation with appropriate ConfirmImpact

Co-authored-by: time-by-waves <34587654+time-by-waves@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: time-by-waves <34587654+time-by-waves@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
# Conflicts:
#	plugins/dataverse/.github/plugin/plugin.json
…an parameters

Completes Issue: Enhance PowerShell instructions for switch parameter usage over boolean parameters #2
@time-by-waves time-by-waves changed the base branch from main to staged March 19, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants