PowerShell / PowerShell/PowerShell
Select-String highlighting / emphasis only works on first Select-String
Open
Nobody has claimed this yet.
Needs-Triage
- Dominant language
- C#
- Stars
- 55.5k
- Forks
- 8.5k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 88
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
The highlighting / emphasis from Select-String is only done for the first instance of Select-String in the pipeline. It should be the last since it is a highlighting technique.
Expected behavior
PowerShell 7.3.6
[C:\Users\lee]
PS:1 > "Hello World" | Select-String Hello
>>Hello<< World
[C:\Users\lee]
PS:2 > "Hello World" | Select-String World
Hello >>World<<
[C:\Users\lee]
PS:3 > "Hello World" | Select-String Hello | Select-String World
Hello >>World<<
[C:\Users\lee]
PS:4 > "Hello World" | Select-String Hello -NoEmphasis | Select-String World
Hello >>World<<
Actual behavior
PowerShell 7.3.6
[C:\Users\lee]
PS:1 > "Hello World" | Select-String Hello
>>Hello<< World
[C:\Users\lee]
PS:2 > "Hello World" | Select-String World
Hello >>World<<
[C:\Users\lee]
PS:3 > "Hello World" | Select-String Hello | Select-String World
>>Hello<< World
[C:\Users\lee]
PS:4 > "Hello World" | Select-String Hello -NoEmphasis | Select-String World
Hello World
(no highlighting / emphasis at all)
Error details
No response
Environment data
Name Value
---- -----
PSVersion 7.3.6
PSEdition Core
GitCommitId 7.3.6
OS Microsoft Windows 10.0.22000
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the four Select-String pipeline examples from the issue and trace how emphasis is carried between successive Select-String commands. Done means the final Select-String controls the highlighting, while -NoEmphasis on the first command does not suppress emphasis from the later command.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, powershell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100