Skip to content

Add $env:__SuppressAnsiEscapeSequences to control whether to have VT escape sequence in output#10814

Merged
TravisEz13 merged 11 commits intoPowerShell:masterfrom
SteveL-MSFT:outputpreference
Oct 24, 2019
Merged

Add $env:__SuppressAnsiEscapeSequences to control whether to have VT escape sequence in output#10814
TravisEz13 merged 11 commits intoPowerShell:masterfrom
SteveL-MSFT:outputpreference

Conversation

@SteveL-MSFT
Copy link
Copy Markdown
Member

@SteveL-MSFT SteveL-MSFT commented Oct 17, 2019

PR Summary

After some discussion, we decided we want to spend more time on the design for customer facing use. Since we need this due to issues with AzDevOps pipelines having some rendering problems, we will make it an undocumented env var for now to use internally and revisit this post PS7 as part of #10811.

Introduce $env:__SuppressAnsiEscapeSequences to suppress VT escape sequences in their output. Updated Select-String, ConciseView, and Get-Error to respect this variable. Also added helper to retrieve VT escape sequences.

PR Checklist

update select-string cmdlet to support this
update ConciseView to support this
update Get-Error to support this
add tests
@ghost ghost added Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept and removed Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept labels Oct 17, 2019
Copy link
Copy Markdown
Contributor

@PaulHigin PaulHigin left a comment

Choose a reason for hiding this comment

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

LGTM

@SteveL-MSFT SteveL-MSFT changed the title Add $OutputPreference to control whether to have VT escape sequence in output Add $env:SuppressAnsiEscapeSequences to control whether to have VT escape sequence in output Oct 18, 2019
@SteveL-MSFT SteveL-MSFT changed the title Add $env:SuppressAnsiEscapeSequences to control whether to have VT escape sequence in output Add $env:__SuppressAnsiEscapeSequences to control whether to have VT escape sequence in output Oct 18, 2019
@SteveL-MSFT
Copy link
Copy Markdown
Member Author

The remaining CodeFactor issue is wrong. Looks like it's looking at an older version of that source file.

@ghost ghost added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Oct 18, 2019
@ghost ghost removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Oct 18, 2019
@SteveL-MSFT
Copy link
Copy Markdown
Member Author

Remaining Codacy issues are by-design

@lzybkr
Copy link
Copy Markdown
Contributor

lzybkr commented Oct 23, 2019

Why not add a command line option instead?

It's somewhat common to support an option like --color [always|auto|never].

@TravisEz13
Copy link
Copy Markdown
Member

@lzybkr This would cause this to be needed in a lot of places in testing.

@TravisEz13 TravisEz13 merged commit 4ff9924 into PowerShell:master Oct 24, 2019
@SteveL-MSFT SteveL-MSFT deleted the outputpreference branch October 24, 2019 20:42
@SteveL-MSFT
Copy link
Copy Markdown
Member Author

@lzybkr you mean cmdline option to pwsh?

@lzybkr
Copy link
Copy Markdown
Contributor

lzybkr commented Oct 24, 2019

@SteveL-MSFT - exactly. There are many tools that have such an option, mostly with the same syntax and options - here's a sampling:

kilasuit pushed a commit to kilasuit/PowerShell that referenced this pull request Nov 9, 2019
@PaulHigin PaulHigin added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Nov 19, 2019
@PaulHigin PaulHigin added this to the 7.0.0-preview.6 milestone Nov 19, 2019
@ghost
Copy link
Copy Markdown

ghost commented Nov 21, 2019

🎉v7.0.0-preview.6 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants