Move version printing to version package

Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Stephen J Day 2015-01-29 15:53:26 -08:00
parent 8f70e298bf
commit b75455d2bd
2 changed files with 27 additions and 6 deletions

26
version/print.go Normal file
View file

@ -0,0 +1,26 @@
package version
import (
"fmt"
"io"
"os"
)
// FprintVersion outputs the version string to the writer, in the following
// format, followed by a newline:
//
// <cmd> <project> <version>
//
// For example, a binary "registry" built from github.com/docker/distribution
// with version "v2.0" would print the following:
//
// registry github.com/docker/distribution v2.0
//
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)
}