Skip to content

Commit 2f7b5e7

Browse files
committed
add completions after last install command
1 parent 70474a1 commit 2f7b5e7

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

.github/workflows/publish-homebrew.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,12 @@ jobs:
5050
brew update
5151
brew style --except-cops FormulaAudit/Homepage,FormulaAudit/Desc,FormulaAuditStrict --fix "Formula/${filename}" || true
5252
53-
# Add shell completions generation before the closing "end" of the install method
53+
# Add shell completions generation after the last bin.install line
5454
if ! grep -q 'generate_completions_from_executable' "Formula/${filename}"; then
55-
sed -i '/^ end$/i\ generate_completions_from_executable(bin/"hotdata", "completions")' "Formula/${filename}"
55+
last_bin_install=$(grep -n 'bin\.install' "Formula/${filename}" | tail -1 | cut -d: -f1)
56+
if [ -n "$last_bin_install" ]; then
57+
sed -i "${last_bin_install}a\\ generate_completions_from_executable(bin/\"hotdata\", \"completions\")" "Formula/${filename}"
58+
fi
5659
fi
5760
5861
git add "Formula/${filename}"

0 commit comments

Comments
 (0)