Skip to content

Commit 9459a83

Browse files
author
Gabriel Monroy
committed
fix(version): add special handling for --version
1 parent 789750d commit 9459a83

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

deisctl.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ import (
1111
docopt "github.com/docopt/docopt-go"
1212
)
1313

14+
const (
15+
// Version of deisctl client
16+
Version string = "0.11.0"
17+
)
18+
1419
func exit(err error, code int) {
1520
fmt.Printf("Error: %v\n", err)
1621
os.Exit(code)
@@ -67,6 +72,11 @@ Options:
6772
--tunnel=<host> establish an SSH tunnel for communication with fleet and etcd [default: ]
6873
--request-timeout=<secs> amount of time to allow a single request before considering it failed. [default: 3.0]
6974
`
75+
// special handling for version
76+
if len(os.Args) == 2 && os.Args[1] == "--version" {
77+
fmt.Println(Version)
78+
os.Exit(0)
79+
}
7080
// parse command-line arguments
7181
args, err := docopt.Parse(usage, nil, true, "", true)
7282
if err != nil {

0 commit comments

Comments
 (0)