小编Qui*_*ijk的帖子

验证数组参数的模式

我有一个接受一个或多个子域的脚本,我想验证它们但[ValidatePattern()]似乎只检查数组中的第一项。

编码:

param(
    [ValidatePattern('\w*\.domain\.com')][string]$subdomain
)
Run Code Online (Sandbox Code Playgroud)

此输入被接受:

.\script.ps1 -subdomain "test.domain.com", "randomstring"
Run Code Online (Sandbox Code Playgroud)

有没有办法验证数组中的每个条目?

powershell

2
推荐指数
1
解决办法
1009
查看次数

vscode 找不到带有诗歌和 wsl 的 python

我想在 vscode 槽 WSL 中使用由诗歌“创建”的 python interperter,但正确的 python 版本没有出现在 vscode 中。

我在 WSL 终端中运行以下命令:

$ poetry shell
Spawning shell within /home/kwint/.cache/pypoetry/virtualenvs/metal-hub-python-py3.7
$ code .
Run Code Online (Sandbox Code Playgroud)

在 vscode 中发现的唯一互操作者是/usr/. 我试过手动输入 virtualenv 的路径,但没有运气。这是路径which python返回:/home/kwint/.cache/pypoetry/virtualenvs/metal-hub-python-py3.7/bin/python

python visual-studio-code python-poetry

1
推荐指数
1
解决办法
1571
查看次数