diff --git a/cmd/server/main.go b/cmd/server/main.go index 41f35814..d523d173 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -4,6 +4,7 @@ import ( "fmt" "net" "os" + "sort" "github.com/Sirupsen/logrus" "github.com/kubernetes-incubator/cri-o/server" @@ -58,6 +59,18 @@ func mergeConfig(config *server.Config, ctx *cli.Context) error { return nil } +type byName []cli.Flag + +func (f byName) Len() int { + return len(f) +} +func (f byName) Less(i, j int) bool { + return f[i].GetName() < f[j].GetName() +} +func (f byName) Swap(i, j int) { + f[i], f[j] = f[j], f[i] +} + func main() { app := cli.NewApp() app.Name = "ocid" @@ -121,6 +134,10 @@ func main() { }, } + // remove once https://github.com/urfave/cli/pull/544 lands + sort.Sort(byName(app.Flags)) + sort.Sort(byName(configCommand.Flags)) + app.Commands = []cli.Command{ configCommand, }