cmd/server: sort flags

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2016-10-13 16:57:48 +02:00
parent 78438e0ec6
commit cf677a20f6
No known key found for this signature in database
GPG key ID: B2BEAD150DE936B9

View file

@ -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,
}