github.com/tompao/docker@v1.9.1/docker/flags.go (about)

     1  package main
     2  
     3  import (
     4  	"sort"
     5  
     6  	"github.com/docker/docker/cli"
     7  	flag "github.com/docker/docker/pkg/mflag"
     8  )
     9  
    10  var (
    11  	flHelp    = flag.Bool([]string{"h", "-help"}, false, "Print usage")
    12  	flVersion = flag.Bool([]string{"v", "-version"}, false, "Print version information and quit")
    13  )
    14  
    15  type byName []cli.Command
    16  
    17  func (a byName) Len() int           { return len(a) }
    18  func (a byName) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
    19  func (a byName) Less(i, j int) bool { return a[i].Name < a[j].Name }
    20  
    21  var dockerCommands []cli.Command
    22  
    23  // TODO(tiborvass): do not show 'daemon' on client-only binaries
    24  
    25  func init() {
    26  	for _, cmd := range cli.DockerCommands {
    27  		dockerCommands = append(dockerCommands, cmd)
    28  	}
    29  	sort.Sort(byName(dockerCommands))
    30  }