diff --git a/cmd/commandfuncs.go b/cmd/commandfuncs.go index c456a813f..8f1c68c82 100644 --- a/cmd/commandfuncs.go +++ b/cmd/commandfuncs.go @@ -331,7 +331,7 @@ func cmdReload(fl Flags) (int, error) { } func cmdVersion(_ Flags) (int, error) { - fmt.Println(caddyVersion()) + fmt.Println(CaddyVersion()) return caddy.ExitCodeSuccess, nil } diff --git a/cmd/commands.go b/cmd/commands.go index 89c4fe43d..ccb82b115 100644 --- a/cmd/commands.go +++ b/cmd/commands.go @@ -61,6 +61,12 @@ type Command struct { // any error that occurred. type CommandFunc func(Flags) (int, error) +// Commands returns a list of commands initialised by +// RegisterCommand +func Commands() map[string]Command { + return commands +} + var commands = make(map[string]Command) func init() { diff --git a/cmd/main.go b/cmd/main.go index deac87fec..8a9a28968 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -420,7 +420,7 @@ func printEnvironment() { fmt.Printf("caddy.AppDataDir=%s\n", caddy.AppDataDir()) fmt.Printf("caddy.AppConfigDir=%s\n", caddy.AppConfigDir()) fmt.Printf("caddy.ConfigAutosavePath=%s\n", caddy.ConfigAutosavePath) - fmt.Printf("caddy.Version=%s\n", caddyVersion()) + fmt.Printf("caddy.Version=%s\n", CaddyVersion()) fmt.Printf("runtime.GOOS=%s\n", runtime.GOOS) fmt.Printf("runtime.GOARCH=%s\n", runtime.GOARCH) fmt.Printf("runtime.Compiler=%s\n", runtime.Compiler) @@ -437,8 +437,8 @@ func printEnvironment() { } } -// caddyVersion returns a detailed version string, if available. -func caddyVersion() string { +// CaddyVersion returns a detailed version string, if available. +func CaddyVersion() string { goModule := caddy.GoModule() ver := goModule.Version if goModule.Sum != "" {