From cf677a20f66c9ae06a4957948d3b03df58b676fc Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Thu, 13 Oct 2016 16:57:48 +0200 Subject: [PATCH] cmd/server: sort flags Signed-off-by: Antonio Murdaca --- cmd/server/main.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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, }