From b7887ed1627002d64b53393c6a7a8a5d64fcd421 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Fri, 4 Aug 2017 13:35:21 +0100 Subject: [PATCH] Update version output --- 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.