2015-01-29 23:53:26 +00:00
|
|
|
package version
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
|
|
|
// FprintVersion outputs the version string to the writer, in the following
|
|
|
|
// format, followed by a newline:
|
|
|
|
//
|
2022-11-02 21:05:45 +00:00
|
|
|
// <cmd> <project> <version>
|
2015-01-29 23:53:26 +00:00
|
|
|
//
|
2020-08-24 11:18:39 +00:00
|
|
|
// For example, a binary "registry" built from github.com/distribution/distribution
|
2015-01-29 23:53:26 +00:00
|
|
|
// with version "v2.0" would print the following:
|
|
|
|
//
|
2022-11-02 21:05:45 +00:00
|
|
|
// registry github.com/distribution/distribution v2.0
|
2015-01-29 23:53:26 +00:00
|
|
|
func FprintVersion(w io.Writer) {
|
|
|
|
fmt.Fprintln(w, os.Args[0], Package, Version)
|
|
|
|
}
|
|
|
|
|
|
|
|
// PrintVersion outputs the version information, from Fprint, to stdout.
|
|
|
|
func PrintVersion() {
|
|
|
|
FprintVersion(os.Stdout)
|
|
|
|
}
|