github.com/richardwilkes/toolbox@v1.121.0/cmdline/version.go (about)

     1  // Copyright (c) 2016-2024 by Richard A. Wilkes. All rights reserved.
     2  //
     3  // This Source Code Form is subject to the terms of the Mozilla Public
     4  // License, version 2.0. If a copy of the MPL was not distributed with
     5  // this file, You can obtain one at http://mozilla.org/MPL/2.0/.
     6  //
     7  // This Source Code Form is "Incompatible With Secondary Licenses", as
     8  // defined by the Mozilla Public License, version 2.0.
     9  
    10  package cmdline
    11  
    12  // ShortVersion returns the app version.
    13  func ShortVersion() string {
    14  	if VCSModified {
    15  		return AppVersion + "~"
    16  	}
    17  	return AppVersion
    18  }
    19  
    20  // LongVersion returns a combination of the app version and the build number.
    21  func LongVersion() string {
    22  	version := AppVersion
    23  	if BuildNumber != "" {
    24  		version += "-" + BuildNumber
    25  	}
    26  	if VCSModified {
    27  		return version + "~"
    28  	}
    29  	return version
    30  }