Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: brew install 🍻 #114

Merged
merged 15 commits into from
Mar 17, 2021
2 changes: 1 addition & 1 deletion .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

60 changes: 39 additions & 21 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,49 @@
# Documentation at http://goreleaser.com
builds:
- main: ./cmd/auth0
env:
- CGO_ENABLED=0
goarch:
- amd64
goos:
- darwin
- linux
- windows
binary: auth0
- main: ./cmd/auth0
env:
- CGO_ENABLED=0
goarch:
- amd64
goos:
- darwin
- linux
- windows
binary: auth0
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: [email protected]
homepage: https://cli.auth0.com
description: Auth0 CLI
jfatta marked this conversation as resolved.
Show resolved Hide resolved
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"
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ Build, test, and manage your integration with **[Auth0](http://auth0.com/)** dir
## Installation

### macOS

#### Homebrew

```
brew install auth0/auth0-cli/auth0
```

#### Manually

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`
Expand Down
6 changes: 4 additions & 2 deletions internal/cli/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import (

func completionCmd(cli *cli) *cobra.Command {
cmd := &cobra.Command{
Use: "completion [bash|zsh|fish|powershell]",
Use: "completion",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to align with other commands but also to keep the skip-login logic simple.

Short: "Setup autocomplete features for this CLI on your terminal",
Long: `To load completions:
Long: `completion [bash|zsh|fish|powershell]

To load completions:

Bash:

Expand Down
5 changes: 5 additions & 0 deletions internal/cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,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.
Expand Down