Skip to content

Commit abfbe3a

Browse files
committed
Added version flag
1 parent 915d041 commit abfbe3a

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

cmd/github-release-cli/travis.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,20 @@ import (
1313
"golang.org/x/oauth2"
1414
)
1515

16-
var (
17-
draft = false
18-
verbose = false
19-
)
16+
var buildTag = ""
2017

2118
func main() {
22-
flag.BoolVar(&draft, "draft", false, "set if the the release should be added as a draft")
23-
flag.BoolVar(&verbose, "verbose", false, "print logging statements")
19+
20+
draft := flag.Bool("draft", false, "set if the the release should be added as a draft")
21+
verbose := flag.Bool("verbose", false, "print logging statements")
22+
version := flag.Bool("version", false, "print the current version of the releaser")
2423
flag.Parse()
2524

25+
if *version {
26+
fmt.Printf("travis releaser version: %s\n", buildTag)
27+
return
28+
}
29+
2630
ctx := context.Background()
2731
ts := oauth2.StaticTokenSource(
2832
&oauth2.Token{AccessToken: os.Getenv("GITHUB_OAUTH_TOKEN")},
@@ -55,7 +59,7 @@ func main() {
5559
}
5660

5761
var logger releaser.Logger
58-
if verbose {
62+
if *verbose {
5963
logger = log.New(os.Stdout, "", log.Ldate|log.Ltime)
6064
}
6165

@@ -66,7 +70,7 @@ func main() {
6670
TagName: tag,
6771
Name: name,
6872
Body: os.Getenv("BODY"),
69-
Draft: draft,
73+
Draft: *draft,
7074
Logger: logger,
7175
}
7276

0 commit comments

Comments
 (0)