From 112f172c64ee834476eb90fd1240143f325939e3 Mon Sep 17 00:00:00 2001 From: Renan DelValle Date: Tue, 23 Oct 2018 15:24:29 -0700 Subject: [PATCH] Adding version command. --- CHANGELOG | 3 ++- cmd/root.go | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index f9f8947..55c51b4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,4 +2,5 @@ * Backup and snapshot commands have now been moved to under the force subcommand as these are expensive operations and the subcommand should reflect that. -* Cobra library upgrade. \ No newline at end of file +* Cobra library upgrade. +* Added version command. \ No newline at end of file diff --git a/cmd/root.go b/cmd/root.go index 140c786..3c41cb3 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -28,6 +28,8 @@ var insecureSkipVerify bool var caCertsPath string var clientKey, clientCert string +const australisVer = "v0.0.5" + var monitorInterval, monitorTimeout int func init() { @@ -39,12 +41,24 @@ func init() { rootCmd.PersistentFlags().StringVarP(&clientCert, "clientCert", "c", "", "Client certificate to use to connect to Aurora.") rootCmd.PersistentFlags().StringVarP(&caCertsPath, "caCertsPath", "a", "", "CA certificates path to use.") rootCmd.PersistentFlags().BoolVarP(&insecureSkipVerify, "insecureSkipVerify", "i", false, "Skip verification.") + + + // Add version command + rootCmd.AddCommand(versionCmd) } func Execute() { rootCmd.Execute() } +var versionCmd = &cobra.Command{ + Use: "version", + Short: "Get version", + PersistentPreRun: func(cmd *cobra.Command, args []string) {}, //We don't need a realis client for this cmd + PersistentPostRun: func(cmd *cobra.Command, args []string) {}, //We don't need a realis client for this cmd + Run: func(cmd *cobra.Command, args []string){ fmt.Println(australisVer) }, +} + func connect(cmd *cobra.Command, args []string) { var err error