Skip to content

Commit

Permalink
fix: completions
Browse files Browse the repository at this point in the history
  • Loading branch information
richaardev committed Dec 4, 2024
1 parent ae122ac commit 8824877
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
6 changes: 1 addition & 5 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json

version: 1

project_name: squarecloud

before:
hooks:
- go mod tidy
- bash ./scripts/completions.sh
- make completions

builds:
- main: ./cmd/squarecloud
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
build:
@go build -o bin/squarecloud cmd/squarecloud/main.go

.PHONY: completions
completions:
mkdir -p completions
bin/squarecloud completion bash >"completions/completions-bash.bash"
bin/squarecloud completion fish >"completions/completions-fish.fish"
bin/squarecloud completion zsh >"completions/completions-zsh.zsh"

.PHONY: install
install:
@mkdir -p /usr/local/bin
install bin/squarecloud /usr/local/bin

.PHONY: uninstall
uninstall:
rm /usr/local/bin/squarecloud
2 changes: 1 addition & 1 deletion cmd/squarecloud/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func newSquareCloudCommand(squareCli *cli.SquareCli) *cobra.Command {
},
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
if cmd.Parent() != nil {
if cli.ShouldCheckAuth(squareCli, cmd) && !cli.CheckAuth(squareCli) {
if cmd.Parent().Name() != "completion" && cli.ShouldCheckAuth(squareCli, cmd) && !cli.CheckAuth(squareCli) {
return fmt.Errorf("you must be logged to execute this command, try to execute: squarecloud login")
}
}
Expand Down
8 changes: 0 additions & 8 deletions scripts/completions.sh

This file was deleted.

0 comments on commit 8824877

Please sign in to comment.