From 22c20e4e329890e989a11409f397e6343adec1fc Mon Sep 17 00:00:00 2001 From: Eric Chiang Date: Mon, 28 Dec 2015 15:56:43 -0800 Subject: [PATCH] cmd: add version subcommand to dexctl closes #220 --- build | 2 +- cmd/dexctl/command_version.go | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 cmd/dexctl/command_version.go diff --git a/build b/build index 564232fa..eec8fd48 100755 --- a/build +++ b/build @@ -11,7 +11,7 @@ mkdir -p $GOPATH/src/github.com/coreos/ LD_FLAGS="-X main.version=$(./git-version)" go build -o bin/dex-worker -ldflags="$LD_FLAGS" github.com/coreos/dex/cmd/dex-worker -go build -o bin/dexctl github.com/coreos/dex/cmd/dexctl +go build -o bin/dexctl -ldflags="$LD_FLAGS" github.com/coreos/dex/cmd/dexctl go build -o bin/dex-overlord -ldflags="$LD_FLAGS" github.com/coreos/dex/cmd/dex-overlord go build -o bin/example-app github.com/coreos/dex/examples/app go build -o bin/example-cli github.com/coreos/dex/examples/cli diff --git a/cmd/dexctl/command_version.go b/cmd/dexctl/command_version.go new file mode 100644 index 00000000..37443f58 --- /dev/null +++ b/cmd/dexctl/command_version.go @@ -0,0 +1,21 @@ +package main + +import "github.com/spf13/cobra" + +var ( + // set by the top level build script + version = "" + + cmdVersion = &cobra.Command{ + Use: "version", + Short: "Print the dexctl version.", + Long: "Print the dexctl version.", + Run: func(cmd *cobra.Command, args []string) { + stdout(version) + }, + } +) + +func init() { + rootCmd.AddCommand(cmdVersion) +}