Skip to content

Commit a3938d8

Browse files
author
Gabriel Monroy
committed
Merge pull request #21 from gabrtv/special-opts
fix(*): handle options correctly
2 parents 72cb9d8 + dce122d commit a3938d8

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

deisctl.go

Lines changed: 10 additions & 1 deletion
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)
@@ -55,7 +60,6 @@ Example Commands:
5560
deisctl journal controller
5661
5762
Options:
58-
--debug print debug information to stderr
5963
--version print version and exit
6064
--endpoint=<url> etcd endpoint for fleet [default: http://127.0.0.1:4001]
6165
--etcd-key-prefix=<path> keyspace for fleet data in etcd [default: /_coreos.com/fleet/]
@@ -67,6 +71,11 @@ Options:
6771
--tunnel=<host> establish an SSH tunnel for communication with fleet and etcd [default: ]
6872
--request-timeout=<secs> amount of time to allow a single request before considering it failed. [default: 3.0]
6973
`
74+
// special handling for version
75+
if len(os.Args) == 2 && os.Args[1] == "--version" {
76+
fmt.Println(Version)
77+
os.Exit(0)
78+
}
7079
// parse command-line arguments
7180
args, err := docopt.Parse(usage, nil, true, "", true)
7281
if err != nil {

0 commit comments

Comments
 (0)