术语“OC_EDITOR =‘subl’不被识别为cmdlet,函数的名称,脚本文件或可操作的程序

问题描述 投票:0回答:1

我想在(窗10)PowerShell中使用以下命令编辑服务:

> oc edit service helloworld -o json

这将打开记事本作为编辑的文件编辑器。然而,我想和语法高亮的编辑器打开它。我已经找到了文档中的以下:Documentation snippet

这将导致以下命令。我已经添加了崇高的文本3〜我的道路,但是当我运行以下命令:

> OC_EDITOR="subl" oc edit service helloworld -o json

输出是:

OC_EDITOR=subl : The term 'OC_EDITOR=subl' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

我已经尝试了所有类型的变化,例如,带/不带引号,sublime_text,但他们似乎并不管用。

运行命令行subl或sublime_text只是打开崇高的文本3。

command-line-interface openshift openshift-origin okd
1个回答
2
投票

你已经发布的截图显示了如何通过设置仅适用于该命令的环境变量覆盖上的Bash(Linux外壳)CLI的oc编辑方向。

我不是太熟悉PowerShell中,但我将承担同样的逻辑也应适用。如果您在您的PowerShell会话一个OC_EDITOR环境变量,它应该允许oc edit到您的崇高文本编辑器。

Set-Item -Path Env:OC_EDITOR -Value subl

您可以确认这是通过设置

Get-ChildItem Env:OC_EDITOR

现在,我没有Windows机器来测试这个安装我的oc工具,但它应该工作。


PowerShell的参考:https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables

© www.soinside.com 2019 - 2024. All rights reserved.