Skip to content

Commit 90b21f9

Browse files
committed
Refactor editor detection in install.ps1 to iterate over a list of editor definitions
- the updating command doesn't work, but the normal one does work ├── install.ps1 └── install.sh
1 parent dbfa57d commit 90b21f9

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

‎install.ps1‎

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,22 @@ $availableEditors = @()
4646
$editorCmds = @()
4747
$editorSchemes = @()
4848

49-
function Check-Editor($Name, $Cmd, $Scheme) {
50-
if (Get-Command $Cmd -ErrorAction SilentlyContinue) {
51-
$script:availableEditors += $Name
52-
$script:editorCmds += $Cmd
53-
$script:editorSchemes += $Scheme
49+
$editorsToCheck = @(
50+
@{ Name = "VS Code"; Cmd = "code"; Scheme = "vscode" },
51+
@{ Name = "VS Code Insiders"; Cmd = "code-insiders"; Scheme = "vscode-insiders" },
52+
@{ Name = "VSCodium"; Cmd = "codium"; Scheme = "vscodium" },
53+
@{ Name = "Cursor"; Cmd = "cursor"; Scheme = "cursor" },
54+
@{ Name = "Antigravity"; Cmd = "agy-ide"; Scheme = "agy" }
55+
)
56+
57+
foreach ($editor in $editorsToCheck) {
58+
if (Get-Command $editor.Cmd -ErrorAction SilentlyContinue) {
59+
$availableEditors += $editor.Name
60+
$editorCmds += $editor.Cmd
61+
$editorSchemes += $editor.Scheme
5462
}
5563
}
5664

57-
Check-Editor "VS Code" "code" "vscode"
58-
Check-Editor "VS Code Insiders" "code-insiders" "vscode-insiders"
59-
Check-Editor "VSCodium" "codium" "vscodium"
60-
Check-Editor "Cursor" "cursor" "cursor"
61-
Check-Editor "Antigravity" "agy-ide" "agy"
62-
6365
if ($availableEditors.Count -eq 0) {
6466
Write-Host "Error: No supported editors found in your PATH." -ForegroundColor Red
6567
Pause

0 commit comments

Comments
 (0)