We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 37bb1a8 commit 44ff301Copy full SHA for 44ff301
cmd/cmd.go
@@ -4,6 +4,7 @@ package cmd
4
import (
5
"fmt"
6
"math/rand"
7
+ "sort"
8
"strings"
9
"time"
10
@@ -657,3 +658,16 @@ func Init(opts ...Option) error {
657
658
func NewCmd(opts ...Option) Cmd {
659
return newCmd(opts...)
660
}
661
+
662
+// Register CLI commands
663
+func Register(cmds ...*cli.Command) {
664
+ app := DefaultCmd.App()
665
+ app.Commands = append(app.Commands, cmds...)
666
667
+ // sort the commands so they're listed in order on the cli
668
+ // todo: move this to micro/cli so it's only run when the
669
+ // commands are printed during "help"
670
+ sort.Slice(app.Commands, func(i, j int) bool {
671
+ return app.Commands[i].Name < app.Commands[j].Name
672
+ })
673
+}
0 commit comments