cmd: version: Add module replace to output

This commit is contained in:
Matthew Holt 2020-01-17 09:50:23 -07:00
parent e51e56a494
commit 85ff0e3604
No known key found for this signature in database
GPG key ID: 2A349DD577D586A5

View file

@ -312,12 +312,18 @@ func cmdReload(fl Flags) (int, error) {
func cmdVersion(_ Flags) (int, error) { func cmdVersion(_ Flags) (int, error) {
goModule := caddy.GoModule() goModule := caddy.GoModule()
fmt.Print(goModule.Version)
if goModule.Sum != "" { if goModule.Sum != "" {
// a build with a known version will also have a checksum // a build with a known version will also have a checksum
fmt.Printf("%s %s\n", goModule.Version, goModule.Sum) fmt.Printf(" %s", goModule.Sum)
} else {
fmt.Println(goModule.Version)
} }
if goModule.Replace != nil {
fmt.Printf(" => %s", goModule.Replace.Path)
if goModule.Replace.Version != "" {
fmt.Printf(" %s", goModule.Replace.Version)
}
}
fmt.Println()
return caddy.ExitCodeSuccess, nil return caddy.ExitCodeSuccess, nil
} }