Skip to content

Commit

Permalink
fix: brew completion
Browse files Browse the repository at this point in the history
  • Loading branch information
thde committed Sep 18, 2024
1 parent 9673557 commit 1fdf9ab
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
17 changes: 9 additions & 8 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ release:
replace_existing_draft: true

archives:
- format_overrides:
- files:
- LICENSE
- README.md
- completions/*
format_overrides:
- goos: windows
format: zip

Expand Down Expand Up @@ -66,13 +70,10 @@ brews:
description: "Interact with Nine API resources."
license: "Apache 2.0"

post_install: |
File.write "nctl.bash", system("nctl", "completions", "-c", "bash")
File.write "nctl.zsh", system("nctl", "completions", "-c", "zsh")
File.write "nctl.fish", system("nctl", "completions", "-c", "fish")
bash_completion.install "nctl.bash"
zsh_completion.install "nctl.zsh"
fish_completion.install "nctl.fish"
extra_install: |
bash_completion.install "completions/nctl.bash" => "nctl"
zsh_completion.install "completions/nctl.zsh" => "_nctl"
fish_completion.install "completions/nctl.fish"
# Setting this will prevent goreleaser to actually try to commit the updated
# formula - instead, the formula file will be stored on the dist folder only,
Expand Down
1 change: 1 addition & 0 deletions completions/nctl.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
complete -o default -o bashdefault -C nctl nctl
7 changes: 7 additions & 0 deletions completions/nctl.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function __complete_nctl
set -lx COMP_LINE (commandline -cp)
test -z (commandline -ct)
and set COMP_LINE "$COMP_LINE "
nctl
end
complete -f -c nctl -a "(__complete_nctl)"
2 changes: 2 additions & 0 deletions completions/nctl.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
autoload -U +X bashcompinit && bashcompinit
complete -o default -o bashdefault -C nctl nctl

0 comments on commit 1fdf9ab

Please sign in to comment.