diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 5891a8a..2361af9 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -45,20 +45,14 @@ brews: tap: owner: scottmmjackson name: homebrew-sj - branch: main pull_request: enabled: true base: main - git: - url: 'ssh://git@github.com:scottmmjackson/bb2todotxt.git' - private_key: '{{ .Env.BREW_KEY }}' - url_template: 'https://github.com/scottmmjackson/bb2todotxt/releases/download/{{ .Tag }}/{{ .ArtifactName }}"' - commit_author: - name: goreleaserbot - email: scottmmjackson@gmail.com + folder: Formula homepage: "https://github.com/scottmmjackson/bb2todotxt" description: Converts pull request tasks from bitbucket to todo txt tasks - license: BSD 3.0 + test: | + system "#{bin}/bb2todotxt -v" checksum: name_template: 'checksums.txt' diff --git a/bb2todotxt.go b/bb2todotxt.go index 4298c05..a995dcd 100644 --- a/bb2todotxt.go +++ b/bb2todotxt.go @@ -12,6 +12,8 @@ import ( "os" ) +const VERSION = "v0.0.3" + type bitbucketConfig struct { Username string `json:username` Password string `json:password` @@ -19,11 +21,16 @@ type bitbucketConfig struct { func commandLine() (*bitbucketConfig, string, string, int, error) { var bitbucketConfigMap *bitbucketConfig + version := flag.Bool("v", false, "print version and quit") slug := flag.String("slug", "", "repo slug") owner := flag.String("owner", "", "repo owner") id := flag.Int("id", 0, "pull request id") bitbucketConfigFile := flag.String("config", "", "Bitbucket config file") flag.Parse() + if *version { + fmt.Println(VERSION) + os.Exit(0) + } if *bitbucketConfigFile == "" { return bitbucketConfigMap, "", "", 0, errors.New("Required flags not provided.") }