【发布时间】:2021-04-06 16:28:29
【问题描述】:
我熟悉使用以下文件夹结构编写自定义 PowerShell 模块:
Modules
| +-- WebUtils
| | +-- WebUtils.psm1
| +-- BuildUtils
| | +-- BuildUtils.psm1
您可以通过执行using module WebUtils 之类的操作来导入 webutils 模块。
我有一个正在进行的大型项目,它重用了许多相同的功能。现在我在一个模块中有一百个左右松散相关的功能。问题是我通常只需要使用其中的 10 - 20 个,具体取决于项目。我想以类似的方式拆分模块:
Modules
| +-- Utils
| | +-- Web
| | | +-- Web.psm1
| | +-- Build
| | | +-- Build.psm1
| | +-- Utils.psm1
我可以像 using module Utils.Web 或类似的名字称呼他们。
我该怎么做呢?我还没有找到任何好的例子。这是组织事物的好方法吗?
【问题讨论】:
标签: powershell project-structure powershell-module