Skip to content

Commit f4b8557

Browse files
Add brew formulae/cask name completion generators
Replace brew_info_generator's broken local-tap-directory approach with 'brew formulae' + 'brew casks' commands that work with modern Homebrew (4.0+, which uses API-based formula discovery instead of local taps). Add all_casks_generator for 'brew cask install' subcommand. Fixes: APP-3510 Co-Authored-By: Oz <oz-agent@warp.dev>
1 parent 8fafc3f commit f4b8557

2 files changed

Lines changed: 17 additions & 9 deletions

File tree

command-signatures/json/brew.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1472,7 +1472,9 @@
14721472
"description": "Installs the given cask",
14731473
"args": {
14741474
"name": "cask",
1475-
"description": "Cask to install"
1475+
"isVariadic": true,
1476+
"description": "Cask to install",
1477+
"generatorName": "all_casks_generator"
14761478
}
14771479
},
14781480
{

command-signatures/src/generators/brew.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,29 @@ pub fn generator() -> CommandSignatureGenerators {
4747
"brew_info_generator",
4848
Generator::script(
4949
CommandBuilder::single_command(
50-
"HBPATH=$(brew --repository); ls -1 $HBPATH/Library/Taps/homebrew/h\
51-
omebrew-core/Formula $HBPATH/Library/Taps/homebrew/homebrew-cask/Casks",
50+
"sh -c 'brew formulae 2>/dev/null; brew casks 2>/dev/null'",
5251
),
5352
|output| {
5453
output
5554
.trim()
5655
.lines()
57-
.map(|line| {
58-
Suggestion::with_description(
59-
line.strip_suffix(".rb").unwrap_or_default(),
60-
"formula",
61-
)
62-
})
56+
.filter(|line| !line.is_empty())
57+
.map(|line| Suggestion::with_description(line, "Formula/Cask"))
6358
.collect_unordered_results()
6459
},
6560
),
6661
)
62+
.add_generator(
63+
"all_casks_generator",
64+
Generator::script(CommandBuilder::single_command("brew casks"), |output| {
65+
output
66+
.trim()
67+
.lines()
68+
.filter(|line| !line.is_empty())
69+
.map(|line| Suggestion::with_description(line, "Cask"))
70+
.collect_unordered_results()
71+
}),
72+
)
6773
.add_generator(
6874
"uninstall_cask",
6975
Generator::script(

0 commit comments

Comments
 (0)