PowerShell / PowerShell/PowerShell

Select-String highlighting / emphasis only works on first Select-String

未关闭
#20,062 10 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Needs-Triage
主要语言
C#
星标
55.5k
派生
8.5k
平均合并
1 天 2 小时
30 天内合并 PR
88

描述

Prerequisites
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
image

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先重现 issue 中的四个 Select-String 管道示例,并跟踪强调如何在连续的 Select-String 命令之间传递。完成的标准是最终的 Select-String 控制高亮显示,而第一个命令中的 -NoEmphasis 不会抑制后续命令的强调。

由索引模型根据 Issue 内容生成。

评估

技术栈
csharp, powershell
领域
cli
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。