From 480e45cd01770f5e38f1ef7215a00244adc9a05f Mon Sep 17 00:00:00 2001 From: niusmallnan Date: Mon, 8 Jan 2018 17:58:43 +0800 Subject: [PATCH] Report image version when using ros version subcommand (#2213) --- cmd/control/cli.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/control/cli.go b/cmd/control/cli.go index da48ca16..3a1679b7 100644 --- a/cmd/control/cli.go +++ b/cmd/control/cli.go @@ -12,6 +12,11 @@ import ( func Main() { log.InitLogger() + cli.VersionPrinter = func(c *cli.Context) { + cfg := config.LoadConfig() + runningName := cfg.Rancher.Upgrade.Image + ":" + config.Version + fmt.Fprintf(c.App.Writer, "version %s from os image %s\n", c.App.Version, runningName) + } app := cli.NewApp() app.Name = os.Args[0]