Skip to content

[Docs]: Add suppressing output guidance to PowerShell style guidelines #224

@MariusStorhaug

Description

@MariusStorhaug

Problem

The PowerShell style guidelines don't include guidance on the best practice for suppressing unwanted output from commands and methods. This leads to inconsistent usage of | Out-Null vs $null = across codebases.

Proposed Solution

Add a "Suppressing Output" section to the pwsh.instructions.md file that documents:

  • Using $null = for suppressing command output (preferred for performance)
  • Using [void] as an alternative for method calls
  • Avoiding | Out-Null due to significant performance overhead
  • Examples of correct and incorrect usage

Expected Outcome

Developers will have clear guidance on how to properly suppress output in PowerShell scripts, leading to better performance and consistent code style across projects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions