summaryrefslogtreecommitdiff
path: root/cmd/commandfuncs.go
diff options
context:
space:
mode:
authoryzongyue <yzongyue@gmail.com>2019-10-09 10:12:15 +0800
committerMatt Holt <mholt@users.noreply.github.com>2019-10-08 20:12:15 -0600
commit53dd600b4de0c2b169f1eb4450a0f02950912524 (patch)
treebd742c34cefeb3a20bdb132937853dd875454f4c /cmd/commandfuncs.go
parentce1205239a7c2300932d0d6819085586660fcce9 (diff)
cmd: Built-in commands all use RegisterCommand (#2794)
Diffstat (limited to 'cmd/commandfuncs.go')
-rw-r--r--cmd/commandfuncs.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/cmd/commandfuncs.go b/cmd/commandfuncs.go
index 5fba368..ec9d974 100644
--- a/cmd/commandfuncs.go
+++ b/cmd/commandfuncs.go
@@ -28,6 +28,7 @@ import (
"os/exec"
"reflect"
"runtime/debug"
+ "sort"
"strings"
"github.com/caddyserver/caddy/v2"
@@ -470,7 +471,13 @@ usage:
commands:
`
- for _, cmd := range commands {
+ keys := make([]string, 0, len(commands))
+ for k := range commands {
+ keys = append(keys, k)
+ }
+ sort.Strings(keys)
+ for _, k := range keys {
+ cmd := commands[k]
short := strings.TrimSuffix(cmd.Short, ".")
s += fmt.Sprintf(" %-15s %s\n", cmd.Name, short)
}