Skip to content

🩹 [Patch]: Add module configuration setting for rich UI rendering #522

@MariusStorhaug

Description

@MariusStorhaug

Describe the change

Overview

Add a configuration setting to control rich UI rendering. This setting should determine how output is rendered by default, based on the environment's support for virtual terminal features.

Details

  • Introduce a new module configuration setting (e.g., RichUIRendering) that determines whether rich UI rendering is enabled.
  • The default value should depend on $Host.UI.SupportsVirtualTerminal. If supported, set $PSStyle.OutputRendering = 'Ansi'; otherwise, set it to 'Host'.
  • Replace all direct usages of $Host.UI.SupportsVirtualTerminal throughout the codebase with (Get-GitHubConfig -Name <new setting>) so that UI rendering can be fully controlled via config.
  • This makes it possible to override the automatic detection for testing or custom scenarios.
  • Requirement: Whenever Set-GitHubConfig -Name 'RichUIRendering' -Value $true or $false is called, the function MUST set $PSStyle.OutputRendering to 'Ansi' or 'Host' respectively, immediately after updating the config value.

Acceptance Criteria

  • New config setting exists and defaults are properly set
  • All usages of $Host.UI.SupportsVirtualTerminal updated to use config
  • Whenever Set-GitHubConfig -Name 'RichUIRendering' -Value ... is called, $PSStyle.OutputRendering is updated accordingly
  • Documentation updated to reflect new configuration
  • Backwards compatibility maintained for environments without virtual terminal support

Example

In Set-GitHubConfig function

if ($Name -eq 'RichUIRendering') {
    if ($Value -eq $true) {
        $PSStyle.OutputRendering = 'Ansi'
    } else {
        $PSStyle.OutputRendering = 'Host'
    }
}

In the private variable that sets the default config:

RichUIRendering = $Host.UI.SupportsVirtualTerminal

This implementation provides flexible and testable UI rendering configuration for the module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions