【发布时间】:2020-02-13 10:58:18
【问题描述】:
我有一个部署过程,其中包括在将某些文件传递给客户端之前对其进行混淆处理,为此,它调用了当前名为 Get-ObfuscateScripts 的自定义 C# Cmdlet。
我的问题是这种自定义 Commandlets 的最佳命名实践是什么,我认为在这种情况下理想的名称是 Obfuscate-Scripts,但这给了我警告信息:
WARNING: The names of some imported commands from the 'xxxxxxxx' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module com
mand again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
我真的不明白这条消息的重点,如果我将它重命名为 Invoke-ObfuscateScripts 之类的东西,智能感知会在 Powershell ISE 或类似的东西上更好地工作吗?还是只是说我应该期望熟练的 Powershell 用户总是通过首先探索批准的动词来探索 API?
【问题讨论】:
-
一件事是,如果您使用了不在批准列表中的动词,则在导入包含该命令的模块时会收到警告。所以这对你的代码的用户来说可能很烦人。但是你可以使用几乎任何你想要的东西。
标签: powershell