Update version output

This commit is contained in:
Henrique Dias 2017-08-04 13:35:21 +01:00
parent 004f6ef0a2
commit b7887ed162
No known key found for this signature in database
GPG Key ID: 936F5EB68D786730
1 changed files with 11 additions and 2 deletions

View File

@ -86,13 +86,22 @@ func setupViper() {
viper.AddConfigPath(".") viper.AddConfigPath(".")
} }
func printVersion() {
if version == "" {
fmt.Println("filemanager is at an untracked version")
} else {
fmt.Println("filemanager", version)
}
os.Exit(0)
}
func main() { func main() {
setupViper() setupViper()
flag.Parse() flag.Parse()
if showVer { if showVer {
fmt.Println("filemanager version", version) printVersion()
os.Exit(0)
} }
// Add a configuration file if set. // Add a configuration file if set.