fnva 0.0.16 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/platforms/fnva +0 -0
- package/platforms/fnva.exe +0 -0
- package/scripts/install-shell-integration.js +19 -4
package/package.json
CHANGED
package/platforms/fnva
CHANGED
|
Binary file
|
package/platforms/fnva.exe
CHANGED
|
Binary file
|
|
@@ -32,15 +32,30 @@ function getPowerShellFunction() {
|
|
|
32
32
|
# fnva 自动化函数 - 由 npm 安装自动添加
|
|
33
33
|
function fnva {
|
|
34
34
|
if ($args.Count -ge 2 -and ($args[0] -eq "java" -or $args[0] -eq "llm" -or $args[0] -eq "cc") -and ($args[1] -eq "use")) {
|
|
35
|
-
$tempFile =
|
|
35
|
+
$tempFile = Join-Path $env:TEMP ("fnva_script_" + (Get-Random) + ".ps1")
|
|
36
36
|
|
|
37
37
|
$env:FNVAAUTOMODE = "1"
|
|
38
38
|
try {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
# 捕获 fnva 输出并保存到临时文件
|
|
40
|
+
$output = cmd.exe /c "set FNVA_AUTO_MODE=%FNVAAUTOMODE% && fnva $args" 2>&1
|
|
41
|
+
|
|
42
|
+
# 如果输出包含 PowerShell 脚本内容,保存并执行
|
|
43
|
+
if ($output -match '\$env:' -or $output -match 'Write-Host') {
|
|
44
|
+
$output | Out-File -FilePath $tempFile -Encoding UTF8
|
|
45
|
+
try {
|
|
46
|
+
& $tempFile
|
|
47
|
+
} catch {
|
|
48
|
+
Write-Host "执行脚本时出错: $_" -ForegroundColor Red
|
|
49
|
+
}
|
|
50
|
+
} else {
|
|
51
|
+
# 如果不是脚本内容,直接输出
|
|
52
|
+
$output
|
|
53
|
+
}
|
|
41
54
|
} finally {
|
|
42
55
|
$env:FNVAAUTOMODE = ""
|
|
43
|
-
|
|
56
|
+
if (Test-Path $tempFile) {
|
|
57
|
+
Remove-Item $tempFile -ErrorAction SilentlyContinue
|
|
58
|
+
}
|
|
44
59
|
}
|
|
45
60
|
} else {
|
|
46
61
|
$env:FNVAAUTOMODE = "1"
|