GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add `isOutputRedirected` parameter to `GetFormatStyleString()` method by SteveL-MSFT · Pull Request #14397 · PowerShell/PowerShell

Conversation

@SteveL-MSFT

@SteveL-MSFT Steve Lee (SteveL-MSFT) commented Dec 11, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

PR Summary

Based on this feedback #13758 (review), instead of checking if output is redirected within the engine, made it a parameter so that the console host and pass that information (and other hosts can do the same).

Also fixed an error in $PSStyle.Formatting formatting.

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Make sure all .h, .cpp, .cs, .ps1 and .psm1 files have the correct copyright header
  • This PR is ready to merge and is not Work in Progress.
    • If the PR is work in progress, please add the prefix WIP: or [ WIP ] to the beginning of the title (the WIP bot will keep its status check at Pending while the prefix is present) and remove the prefix when the PR is ready.
  • Breaking changes
    • None
    • OR
    • Experimental feature(s) needed
      • Experimental feature name(s):
  • User-facing changes
    • Not Applicable
    • OR
    • Documentation needed
      • Issue filed:
  • Testing - New and feature
    • N/A or can only be tested interactively
    • OR
    • Make sure you've added a new test if existing tests do not effectively test the code changed
  • Tooling
    • I have considered the user experience from a tooling perspective and don't believe tooling will be impacted.
    • OR
    • I have considered the user experience from a tooling perspective and enumerated concerns in the summary. This may include:
      • Impact on PowerShell Editor Services which is used in the PowerShell extension for VSCode (which runs in a different PS Host).
      • Impact on Completions (both in the console and in editors) - one of PowerShell's most powerful features.
      • Impact on PSScriptAnalyzer (which provides linting & formatting in the editor extensions).
      • Impact on EditorSyntax (which provides syntax highlighting with in VSCode, GitHub, and many other editors).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@SteveL-MSFT
Steve Lee (SteveL-MSFT) requested review from Andrew (anmenaga) and Dongbo Wang (daxian-dbw) as code owners December 11, 2020 19:18
@ghost ghost assigned Ilya (iSazonov) Dec 11, 2020
@SteveL-MSFT Steve Lee (SteveL-MSFT) assigned Dongbo Wang (daxian-dbw) and unassigned Ilya (iSazonov) Dec 11, 2020
@SteveL-MSFT Steve Lee (SteveL-MSFT) mentioned this pull request Dec 11, 2020
Enable simpler ANSI formatting via $PSStyle and support suppressing ANSI output #13758
Merged
10 of 14 tasks
@SteveL-MSFT Steve Lee (SteveL-MSFT) added this to the 7.2-Consider milestone Dec 16, 2020
@ghost ghost removed this from the 7.2-Consider milestone Dec 16, 2020
@ghost

Deleted user (ghost) commented Dec 16, 2020

Copy link
Copy Markdown

Open PRs should not be assigned to milestone, so they are not assigned to the wrong milestone after they are merged. For backport consideration, use a backport label.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SteveL-MSFT Steve Lee (SteveL-MSFT) added the Backport-7.2.x-Consider label Dec 16, 2020
@ghost ghost added the Review - Needed The PR is being reviewed label Dec 24, 2020
@ghost

Deleted user (ghost) commented Dec 24, 2020

Copy link
Copy Markdown

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SteveL-MSFT
Steve Lee (SteveL-MSFT) force-pushed the isredirected branch from b5a6f30 to 9fb8e62 Compare March 6, 2021 01:38
@iSazonov

Ilya (iSazonov) commented Mar 6, 2021

Copy link
Copy Markdown
Collaborator

The PR should close #14387

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost ghost removed the Review - Needed The PR is being reviewed label Mar 6, 2021
@ghost ghost added the Review - Needed The PR is being reviewed label Mar 13, 2021
@ghost

Deleted user (ghost) commented Mar 13, 2021

Copy link
Copy Markdown

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@daxian-dbw
Dongbo Wang (daxian-dbw) force-pushed the isredirected branch from 9fb8e62 to e5c4a60 Compare September 8, 2021 20:25
daxian-dbw
Dongbo Wang (daxian-dbw) approved these changes Sep 8, 2021
View reviewed changes

@daxian-dbw Dongbo Wang (daxian-dbw) left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Steve Lee (@SteveL-MSFT) Sorry that I lost track of this PR. The changes look good to me, but it doesn't address all the issues tracked in #14387.

I think we need to make GetOutputString and GetFormatStyleString public, so that other host implementation can behave just like the console host. Otherwise, other hosts will have to copy the source code of those 2 methods. What do you think?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@daxian-dbw

Dongbo Wang (daxian-dbw) commented Sep 8, 2021

Copy link
Copy Markdown
Member

The markdown test failed due to a broken link, which has nothing to do with this PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost ghost removed the Review - Needed The PR is being reviewed label Sep 8, 2021
Steve Lee (SteveL-MSFT) added 2 commits September 8, 2021 16:46
@SteveL-MSFT
Add isOutputRedirected parameter to GetFormatStyleString() method…
f0de71a
… instead of checking within the method
@SteveL-MSFT
remove unused code
62941e4
@SteveL-MSFT
Steve Lee (SteveL-MSFT) force-pushed the isredirected branch from e5c4a60 to 62941e4 Compare September 8, 2021 23:46
@SteveL-MSFT

Steve Lee (SteveL-MSFT) commented Sep 8, 2021

Copy link
Copy Markdown
Member Author

Dongbo Wang (@daxian-dbw) I think we can defer making those APIs public util we have a host that needs it

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@daxian-dbw

Dongbo Wang (daxian-dbw) commented Sep 9, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Steve Lee (@SteveL-MSFT) The host of PowerShell Jupyter kernel will need them. Once .NET interactive adopts PowerShell 7.2, it will be a matter of time for users to open the issue about $PSStyle not working in the PowerShell sub-kernel.

And, maybe the PSES host will need them too? Rob Holt (@rjmholt) can you please weigh in.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@daxian-dbw
Dongbo Wang (daxian-dbw) merged commit 024f409 into PowerShell:master Sep 9, 2021
@daxian-dbw Dongbo Wang (daxian-dbw) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Sep 9, 2021
@daxian-dbw Dongbo Wang (daxian-dbw) added this to the 7.2.0-rc.1 milestone Sep 9, 2021
@SteveL-MSFT
Steve Lee (SteveL-MSFT) deleted the isredirected branch September 9, 2021 21:18
@daxian-dbw Dongbo Wang (daxian-dbw) mentioned this pull request Sep 10, 2021
Move GetOuputString() and GetFormatStyleString() to PSHostUserInterface as public API #16075
Merged
8 of 22 tasks
@adityapatwardhan Aditya Patwardhan (adityapatwardhan) added Backport-7.2.x-Done and removed Backport-7.2.x-Consider labels Sep 15, 2021
Travis Plunk (TravisEz13) pushed a commit that referenced this pull request Sep 29, 2021
@SteveL-MSFT @adityapatwardhan
Add isOutputRedirected parameter to GetFormatStyleString() method (…
c140137
…#14397)
TrapGodBrim pushed a commit to TrapGodBrim/PowerShell that referenced this pull request Jan 19, 2022
@SteveL-MSFT @TrapGodBrim
Add isOutputRedirected parameter to GetFormatStyleString() method (…
8297203
…PowerShell#14397)
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
@SteveL-MSFT
Add isOutputRedirected parameter to GetFormatStyleString() method (…
355a20c
…PowerShell#14397)
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
@SteveL-MSFT @adityapatwardhan
Add isOutputRedirected parameter to GetFormatStyleString() method (…
d3ed5c9
…PowerShell#14397)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@daxian-dbw Dongbo Wang (daxian-dbw) daxian-dbw approved these changes
@anmenaga Andrew (anmenaga) Awaiting requested review from anmenaga

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@daxian-dbw Dongbo Wang (daxian-dbw)

Labels

Backport-7.2.x-Done CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Milestone

7.2.0-preview.10

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@SteveL-MSFT @iSazonov @daxian-dbw @adityapatwardhan
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.