From bc2c84b3ea942c0a051a03a1519e95280e9fe1a1 Mon Sep 17 00:00:00 2001 From: Vu Quoc Huy Date: Sat, 3 Dec 2016 02:10:12 +0700 Subject: [PATCH] Add version command --- bots/coniksbot/internal/cmd/version.go | 22 +++++++++++++++++++ client/coniksclient/internal/cmd/version.go | 22 +++++++++++++++++++ internal/version.go | 4 ++++ .../coniksserver/internal/cmd/version.go | 22 +++++++++++++++++++ 4 files changed, 70 insertions(+) create mode 100644 bots/coniksbot/internal/cmd/version.go create mode 100644 client/coniksclient/internal/cmd/version.go create mode 100644 internal/version.go create mode 100644 keyserver/coniksserver/internal/cmd/version.go diff --git a/bots/coniksbot/internal/cmd/version.go b/bots/coniksbot/internal/cmd/version.go new file mode 100644 index 0000000..68b5d2a --- /dev/null +++ b/bots/coniksbot/internal/cmd/version.go @@ -0,0 +1,22 @@ +package cmd + +import ( + "fmt" + + "github.com/coniks-sys/coniks-go/internal" + "github.com/spf13/cobra" +) + +var versionCmd = &cobra.Command{ + Use: "version", + Short: "Print the version number of coniksbot.", + Long: `Print the version number of coniksbot.`, + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("All software has versions. This is coniksbot's:") + fmt.Println("coniksbot v" + internal.Version) + }, +} + +func init() { + RootCmd.AddCommand(versionCmd) +} diff --git a/client/coniksclient/internal/cmd/version.go b/client/coniksclient/internal/cmd/version.go new file mode 100644 index 0000000..8bc8ddf --- /dev/null +++ b/client/coniksclient/internal/cmd/version.go @@ -0,0 +1,22 @@ +package cmd + +import ( + "fmt" + + "github.com/coniks-sys/coniks-go/internal" + "github.com/spf13/cobra" +) + +var versionCmd = &cobra.Command{ + Use: "version", + Short: "Print the version number of coniksclient.", + Long: `Print the version number of coniksclient.`, + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("All software has versions. This is coniksclient's:") + fmt.Println("coniksclient v" + internal.Version) + }, +} + +func init() { + RootCmd.AddCommand(versionCmd) +} diff --git a/internal/version.go b/internal/version.go new file mode 100644 index 0000000..8cd5a2a --- /dev/null +++ b/internal/version.go @@ -0,0 +1,4 @@ +package internal + +// Version of executables. +var Version = "0.0.0+git" diff --git a/keyserver/coniksserver/internal/cmd/version.go b/keyserver/coniksserver/internal/cmd/version.go new file mode 100644 index 0000000..dd9314d --- /dev/null +++ b/keyserver/coniksserver/internal/cmd/version.go @@ -0,0 +1,22 @@ +package cmd + +import ( + "fmt" + + "github.com/coniks-sys/coniks-go/internal" + "github.com/spf13/cobra" +) + +var versionCmd = &cobra.Command{ + Use: "version", + Short: "Print the version number of coniksserver.", + Long: `Print the version number of coniksserver.`, + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("All software has versions. This is coniksserver's:") + fmt.Println("coniksserver v" + internal.Version) + }, +} + +func init() { + RootCmd.AddCommand(versionCmd) +}