print.go 584 B

1234567891011121314151617181920212223242526
  1. package version
  2. import (
  3. "fmt"
  4. "io"
  5. "os"
  6. )
  7. // FprintVersion outputs the version string to the writer, in the following
  8. // format, followed by a newline:
  9. //
  10. // <cmd> <project> <version>
  11. //
  12. // For example, a binary "registry" built from github.com/docker/distribution
  13. // with version "v2.0" would print the following:
  14. //
  15. // registry github.com/docker/distribution v2.0
  16. //
  17. func FprintVersion(w io.Writer) {
  18. fmt.Fprintln(w, os.Args[0], Package, Version)
  19. }
  20. // PrintVersion outputs the version information, from Fprint, to stdout.
  21. func PrintVersion() {
  22. FprintVersion(os.Stdout)
  23. }