我的配置文件中有一个命令行开关,可以重新加载我的用户配置文件。每当我编辑我的个人资料时,VSCode 都会警告我,我使用的名称——Reload-Profile——使用了一个未经批准的动词。

虽然 Reload 似乎是一个理智、明显且易于搜索的动词来描述重新加载资源,但我想知道我应该使用什么来保持 PS 快乐。 list of approved verbs 上的候选人似乎都没有描述重装之类的事情。

这是代码顺便说一句(我从 this answer 得到它)

  function Reload-Profile {
    @($Profile.AllUsersAllHosts,
    $Profile.AllUsersCurrentHost,
    $Profile.CurrentUserAllHosts,
    $Profile.CurrentUserCurrentHost
    ) | ForEach-Object {
      if(Test-Path $_){
        Write-Host "Running $_" -foregroundcolor Magenta
        . $_
      }
    }
  }

最佳答案

我会和 Invoke 一起去。运行命令是Invoke-Command,运行表达式是Invoke-Expression,运行pester是Invoke-Pester,当Pester要运行mock时,用Invoke-Mock等等。

Invoke 是要求执行某事的 goto 动词。

关于powershell - 什么 powershell 动词适合重新加载用户配置文件?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/54898748/

10-13 09:28