Consolidate the files in client/

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin
2016-04-25 12:05:42 -04:00
parent 315e242b9c
commit ec6cc96fa1
5 changed files with 41 additions and 50 deletions

22
usage.go Normal file
View File

@ -0,0 +1,22 @@
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
}