From 68cb4ee980ef6822d7073f168369dd1725909844 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Fri, 4 Aug 2017 13:35:21 +0100 Subject: [PATCH] Update version output Former-commit-id: 0d8bbcef2b4cdb93fc7c4929b875eb920fc01a64 [formerly 8bf71ac7db4a94d47346bbe382b135f60bc00788] [formerly 1426e8119be5d07f0d2a759f30784a223d76208d [formerly b7887ed1627002d64b53393c6a7a8a5d64fcd421]] Former-commit-id: 3e0d9dff358868119c6d3b109896259b84a1e565 [formerly e15610b544cb000a0ce88392bd13949a578fd605] Former-commit-id: 6497b3d602ac78be939abc70d6c337799e9d85d8 --- cmd/filemanager/main.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cmd/filemanager/main.go b/cmd/filemanager/main.go index 3305c695..149ef844 100644 --- a/cmd/filemanager/main.go +++ b/cmd/filemanager/main.go @@ -86,13 +86,22 @@ func setupViper() { viper.AddConfigPath(".") } +func printVersion() { + if version == "" { + fmt.Println("filemanager is at an untracked version") + } else { + fmt.Println("filemanager", version) + } + + os.Exit(0) +} + func main() { setupViper() flag.Parse() if showVer { - fmt.Println("filemanager version", version) - os.Exit(0) + printVersion() } // Add a configuration file if set.