From e109c70d62e1f3e396b7a0086a9e4fc49b41e8d3 Mon Sep 17 00:00:00 2001 From: "Jorge L. Fatta" Date: Wed, 17 Mar 2021 17:10:02 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20brew=20install=20=F0=9F=8D=BB=20(#114)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: add brew * set a GH token for goreleaser the provided GITHUB_TOKEN is not enough if we need to push to another repo (brew tap): https://github.com/goreleaser/goreleaser-action#limitation * set tap name * fix: skip login for completion command * fix: brew completion step * update readme * fix completion props * fix: completion from install formula * Apply suggestions from code review Co-authored-by: Cyril David * Update README.md Co-authored-by: Rita Zerrizuela Co-authored-by: Cyril David --- .github/workflows/goreleaser.yml | 2 +- .goreleaser.yml | 40 +++++++++++++++++++++++--------- README.md | 1 + internal/cli/completion.go | 6 +++-- internal/cli/root.go | 5 ++++ 5 files changed, 40 insertions(+), 14 deletions(-) diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index 74e23fe14..6f71c47b5 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -25,4 +25,4 @@ jobs: version: latest args: release --rm-dist env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml index 42f9bd3c6..51a700662 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -16,21 +16,39 @@ builds: - -X github.com/auth0/auth0-cli/internal/buildinfo.BuildUser=goreleaser' - -X github.com/auth0/auth0-cli/internal/buildinfo.BuildDate={{.Date}}' archives: -- replacements: - darwin: Darwin - linux: Linux - windows: Windows - 386: i386 - amd64: x86_64 - files: - - none* + - replacements: + darwin: Darwin + linux: Linux + windows: Windows + 386: i386 + amd64: x86_64 + files: + - none* checksum: - name_template: 'checksums.txt' + name_template: "checksums.txt" snapshot: name_template: "{{ .Tag }}-SNAPSHOT-{{.ShortCommit}}" changelog: sort: asc filters: exclude: - - '^docs:' - - '^test:' + - "^docs:" + - "^test:" +brews: + - + name: auth0 + tap: + owner: auth0 + name: homebrew-auth0-cli + commit_author: + name: auth0 + email: support@auth0.com + homepage: https://cli.auth0.com + description: Supercharge your developer workflow. + install: | + bin.install "auth0" + + (bash_completion/"auth0").write `#{bin}/auth0 completion bash` + (fish_completion/"auth0.fish").write `#{bin}/auth0 completion fish` + (zsh_completion/"_auth0").write `#{bin}/auth0 completion zsh` + caveats: "Thanks for installing Auth0 CLI" diff --git a/README.md b/README.md index 290c0ef4f..3e659df87 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Build, test, and manage your integration with **[Auth0](http://auth0.com/)** dir ## Installation ### macOS + 1. Download the binaries from: https://github.com/auth0/auth0-cli/releases/latest/ 1. Extract 1. Move `auth0` to `/usr/local/bin/auth0`, e.g.: `mv ~/Desktop/auth0 /usr/local/bin` diff --git a/internal/cli/completion.go b/internal/cli/completion.go index 01adc31eb..75b3a9f3a 100644 --- a/internal/cli/completion.go +++ b/internal/cli/completion.go @@ -8,9 +8,11 @@ import ( func completionCmd(cli *cli) *cobra.Command { cmd := &cobra.Command{ - Use: "completion [bash|zsh|fish|powershell]", + Use: "completion", Short: "Setup autocomplete features for this CLI on your terminal", - Long: `To load completions: + Long: `completion [bash|zsh|fish|powershell] + +To load completions: Bash: diff --git a/internal/cli/root.go b/internal/cli/root.go index 26ca3bc95..95819c2d5 100644 --- a/internal/cli/root.go +++ b/internal/cli/root.go @@ -47,6 +47,11 @@ func Execute() { return nil } + // Getting the CLI completion script shouldn't trigger a login. + if cmd.Use == "completion" && cmd.Parent().Use == "auth0" { + return nil + } + // Initialize everything once. Later callers can then // freely assume that config is fully primed and ready // to go.