2014-08-01 13:34:06 -04:00
|
|
|
package main
|
|
|
|
|
2015-10-08 08:46:21 -04:00
|
|
|
import (
|
|
|
|
"sort"
|
|
|
|
|
|
|
|
"github.com/docker/docker/cli"
|
2014-08-01 13:34:06 -04:00
|
|
|
)
|
|
|
|
|
2015-10-08 08:46:21 -04:00
|
|
|
type byName []cli.Command
|
2015-05-07 19:18:13 -04:00
|
|
|
|
|
|
|
func (a byName) Len() int { return len(a) }
|
|
|
|
func (a byName) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
2015-10-08 08:46:21 -04:00
|
|
|
func (a byName) Less(i, j int) bool { return a[i].Name < a[j].Name }
|
|
|
|
|
2015-05-05 00:18:28 -04:00
|
|
|
// TODO(tiborvass): do not show 'daemon' on client-only binaries
|
2015-10-08 08:46:21 -04:00
|
|
|
|
2016-04-25 12:05:42 -04:00
|
|
|
func sortCommands(commands []cli.Command) []cli.Command {
|
|
|
|
dockerCommands := make([]cli.Command, len(commands))
|
|
|
|
copy(dockerCommands, commands)
|
2015-10-08 08:46:21 -04:00
|
|
|
sort.Sort(byName(dockerCommands))
|
2016-04-25 12:05:42 -04:00
|
|
|
return dockerCommands
|
2014-08-01 13:34:06 -04:00
|
|
|
}
|