From 4fb47a833a59f16f7f9b0c37bda1f1c0fe563542 Mon Sep 17 00:00:00 2001 From: KUOKA Yusuke Date: Sat, 1 Aug 2020 10:37:34 +0900 Subject: [PATCH] Add version sub-command (#1389) Resolves #1369 --- Makefile | 2 +- main.go | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0d2c3fce..dfdc49fb 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ ORG ?= $(shell basename $(realpath ..)) PKGS := $(shell go list ./... | grep -v /vendor/) build: - go build ${TARGETS} + go build -ldflags '-X github.com/roboll/helmfile/pkg/app/version.Version=${TAG}' ${TARGETS} .PHONY: build generate: diff --git a/main.go b/main.go index 0aed3772..369ad951 100644 --- a/main.go +++ b/main.go @@ -486,6 +486,15 @@ func main() { return run.ListReleases(c) }), }, + { + Name: "version", + Usage: "Show the version for Helmfile.", + ArgsUsage: "[command]", + Action: func(c *cli.Context) error { + cli.ShowVersion(c) + return nil + }, + }, } err := cliApp.Run(os.Args)