From bcbddd483b85f5a60601e33d4d2adf86dcb2168c Mon Sep 17 00:00:00 2001 From: Dirk Wilden Date: Wed, 12 Dec 2018 16:25:43 +0100 Subject: [PATCH] add version command --- cmd/version.go | 20 ++++++++++++++++++++ create_release.sh | 14 ++++++++++++++ version | 1 - 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 cmd/version.go create mode 100755 create_release.sh delete mode 100644 version diff --git a/cmd/version.go b/cmd/version.go new file mode 100644 index 0000000..1c01340 --- /dev/null +++ b/cmd/version.go @@ -0,0 +1,20 @@ +package cmd + +import ( + "github.com/deviceinsight/kafkactl/output" + "github.com/spf13/cobra" +) + +const VERSION = "0.0.1" + +var cmdVersion = &cobra.Command{ + Use: "version", + Short: "print the version of kafkactl", + Run: func(cmd *cobra.Command, args []string) { + output.Infof(VERSION) + }, +} + +func init() { + rootCmd.AddCommand(cmdVersion) +} diff --git a/create_release.sh b/create_release.sh new file mode 100755 index 0000000..5cd1390 --- /dev/null +++ b/create_release.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +version=$1 + +if [ "$version" == "" ]; then + echo "enter release version:" + read version +fi + +version_go="cmd/version.go" + +echo "updating $version_go to version $version..." +eval "sed -i 's/const VERSION = .*/const VERSION = \"$version\"/g' $version_go" +echo "done" diff --git a/version b/version deleted file mode 100644 index 8a9ecc2..0000000 --- a/version +++ /dev/null @@ -1 +0,0 @@ -0.0.1 \ No newline at end of file