@@ -448,7 +448,7 @@ function Sync-PathFromBash {
448448 param ()
449449
450450 try {
451- Write-Verbose " 正在从 Bash 登录 Shell 中获取 PATH..."
451+ Write-Information " 正在从 Bash 登录 Shell 中获取 PATH..."
452452 # 使用 'bash -l' 确保加载了 ~/.profile 或 ~/.bash_profile
453453 # '-c' 表示执行后面的命令
454454 $bashPathOutput = bash - l - c ' echo $PATH'
@@ -464,29 +464,29 @@ function Sync-PathFromBash {
464464 $bashPaths = $bashPathOutput.Split ($separator , [System.StringSplitOptions ]::RemoveEmptyEntries)
465465 $psPaths = $env: PATH.Split ($separator , [System.StringSplitOptions ]::RemoveEmptyEntries)
466466
467- Write-Verbose " 从 Bash 中找到的路径: $ ( $bashPaths.Count ) 个"
468- Write-Verbose " 当前 PowerShell 中的路径: $ ( $psPaths.Count ) 个"
467+ Write-Information " 从 Bash 中找到的路径: $ ( $bashPaths.Count ) 个"
468+ Write-Information " 当前 PowerShell 中的路径: $ ( $psPaths.Count ) 个"
469469
470470 # 使用 Compare-Object 找出只存在于 Bash PATH 中的路径
471471 # ReferenceObject 是基准,DifferenceObject 是要比较的对象
472472 $missingPaths = Compare-Object - ReferenceObject $psPaths - DifferenceObject $bashPaths - PassThru | Where-Object { $_ -ne $null }
473473
474474 if ($missingPaths.Count -gt 0 ) {
475- Write-Host " 发现 $ ( $missingPaths.Count ) 个需要从 Bash 同步的路径。" - ForegroundColor Yellow
475+ Write-Information " 发现 $ ( $missingPaths.Count ) 个需要从 Bash 同步的路径。"
476476
477477 # 将找到的缺失路径连接成一个字符串
478478 $pathsToAdd = $missingPaths -join $separator
479479
480480 # 遍历并显示将要添加的每一个路径
481481 foreach ($path in $missingPaths ) {
482- Write-Host " -> 正在添加: $path " - ForegroundColor Green
482+ Write-Information " -> 正在添加: $path "
483483 }
484484
485485 # 将新路径追加到现有的 PowerShell PATH 后面
486486 $env: PATH = " $ ( $env: PATH ) $separator$pathsToAdd "
487- Write-Host " PowerShell PATH 已成功更新!" - ForegroundColor Green
487+ Write-Information " PowerShell PATH 已成功更新!"
488488 } else {
489- Write-Verbose " Power-Shell 的 PATH 与 Bash 完全同步,无需操作。"
489+ Write-Information " Power-Shell 的 PATH 与 Bash 完全同步,无需操作。"
490490 }
491491 }
492492 catch {
0 commit comments