powershell - 删除 NuGet 源(如果存在)
问题描述
我正在尝试检测是否已将源添加到配置文件中。如果已添加,我想将其删除。棘手的部分是我最初不会知道源的名称,但我知道路径。
使用nuget sources list -configfile C:\Temp\NuGet.Config
我能够识别已添加的源,但这会返回一个字符串。
如何根据源路径识别是否添加了源并提取源名称以便我可以将其删除?
一些伪代码:
nuget sources add -name "example.com" -source "https://nuget.example.com/nuget" -username "example" -password "example" -storepasswordincleartext -configfile C:\Temp\NuGet.Config
if source exists with path 'https://nuget.example.com/nuget':
remove source
解决方案
推荐阅读
- python - Numpy 生成随机整数
- security - “加密传输中的 ENV 变量”aws lambda 功能可以防止什么攻击?
- python - Python - 异步 HTTP 请求,最后阻塞以获取完整响应 HTTP(urllib3,请求,线程)
- flash - 鼠标 x +1 = 影片剪辑时间轴帧数 + 1
- rotation - 当我的应用仅支持横向模式时如何获取旋转矢量值
- c# - 将对象属性(包括具有私有 setter 的属性)深度复制到另一个相同类型的对象
- c# - How to P/Invoke os_log?
- python - 函数中的常量,而不是单独的文件
- javascript - 在 moment.js 中获取从现在开始的时间差异
- c++ - 该程序的输出说明: