From d9b4439c8316e6387ac002c893ebc0cabdf85f6f Mon Sep 17 00:00:00 2001 From: Lantao Liu Date: Wed, 29 Nov 2017 20:49:34 +0000 Subject: [PATCH] Sort flags for all commands. Signed-off-by: Lantao Liu --- cmd/crictl/main.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/crictl/main.go b/cmd/crictl/main.go index fb5868f661..ee62f757c0 100644 --- a/cmd/crictl/main.go +++ b/cmd/crictl/main.go @@ -20,6 +20,7 @@ import ( "fmt" "net" "os" + "sort" "time" "github.com/Sirupsen/logrus" @@ -200,6 +201,12 @@ func main() { } return nil } + // sort all flags + for _, cmd := range app.Commands { + sort.Sort(cli.FlagsByName(cmd.Flags)) + } + sort.Sort(cli.FlagsByName(app.Flags)) + if err := app.Run(os.Args); err != nil { logrus.Fatal(err) }