Z-Y*_*Y.L 4 powershell psreadline
根据此博客,我已经美化了Powershell ,但是Operator和Parameter如下所示为灰色:
所以我通过Set-PSReadlineOption以下方式更改它们的颜色:
Set-PSReadlineOption -TokenKind Operator -ForegroundColor Yellow
Run Code Online (Sandbox Code Playgroud)
但出现以下错误:
Set-PSReadLineOption:找不到与参数名称“ TokenKind”匹配的参数?
???? ?:1 ??:22
- Set-PSReadlineOption -TokenKind运算符-ForegroundColor黄色
- CategoryInfo:InvalidArgument:(:) [Set-PSReadLineOption]?ParameterBindingException
- FullyQualifiedErrorId:NamedParameterNotFound,Microsoft.PowerShell.SetPSReadLineOption
但是显示的帮助文件Set-PSReadlineOption显示它具有一个TokenKind参数,Operator而该参数又可以作为其参数。
我很困惑为什么会发生此错误。
我的powershell版本是
感谢您的任何建议!
他们进行了PSReadline V2的重大更改,请在此处阅读:https : //github.com/lzybkr/PSReadLine/issues/738
所以代替
Set-PSReadlineOption -TokenKind String -ForegroundColor Magenta
Set-PSReadlineOption -TokenKind Variable -ForegroundColor Cyan
Run Code Online (Sandbox Code Playgroud)
你会做类似的事情
$colors = @{}
$colors['String'] = [System.ConsoleColor]::Magenta
$colors['Variable'] = [System.ConsoleColor]::Cyan
Set-PSReadLineOption -Colors $colors
Run Code Online (Sandbox Code Playgroud)
我认为也有一种在哈希表中指定前景色/背景色的方法,但尚未弄清楚。
在此处阅读Set-PSReadLineOption文档。
| 归档时间: |
|
| 查看次数: |
2692 次 |
| 最近记录: |