open代码:-OpenCode 配置网络 - exe not found
在使用全局环境变量配置网络的时候会影响一些工具的使用,比如git。需要写了个脚本单独给opencode配置环境变量。
C:\Users\用户名\Documents\WindowsPowerShell
在这个目录下新建Microsoft.PowerShell_profile.ps1文件(如果没有WindowsPowerShell,直接新建)
写入:
function opencode-with-proxy {
$env:http_proxy = "http://127.0.0.1:7890" 拼多多帮助力入口
$env:https_proxy = "http://127.0.0.1:7890"
$nativeOpencodePath = "C:\Users\用户名\scoop\apps\opencode\current\opencode.exe"
if (Test-Path $nativeOpencodePath) {
& $nativeOpencodePath @args
} else {
Write-Host "Error: opencode.exe not found. Please check the path is correct." -ForegroundColor Red
}
Remove-Item Env:http_proxy -ErrorAction SilentlyContinue
Remove-Item Env:https_proxy -ErrorAction SilentlyContinue
}
Set-Alias -Name opencode -Value opencode-with-proxy -Force -ErrorAction SilentlyContinue
注意:要修改网络端口号与opencode本地路径。,open代码