mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
01a34e43b3
Signed-off-by: Daniel Nephin <dnephin@docker.com>
22 lines
552 B
Go
22 lines
552 B
Go
package main
|
|
|
|
import (
|
|
"sort"
|
|
|
|
"github.com/docker/docker/cli"
|
|
)
|
|
|
|
type byName []cli.Command
|
|
|
|
func (a byName) Len() int { return len(a) }
|
|
func (a byName) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
|
func (a byName) Less(i, j int) bool { return a[i].Name < a[j].Name }
|
|
|
|
// TODO(tiborvass): do not show 'daemon' on client-only binaries
|
|
|
|
func sortCommands(commands []cli.Command) []cli.Command {
|
|
dockerCommands := make([]cli.Command, len(commands))
|
|
copy(dockerCommands, commands)
|
|
sort.Sort(byName(dockerCommands))
|
|
return dockerCommands
|
|
}
|