mirror of https://github.com/docker/docs.git
Move HostListItem from host.go to command.go
Signed-off-by: Guillaume Giamarchi <guillaume.giamarchi@gmail.com>
This commit is contained in:
parent
8797ca2d50
commit
d8921ee432
23
commands.go
23
commands.go
|
|
@ -18,6 +18,7 @@ import (
|
|||
_ "github.com/docker/machine/drivers/digitalocean"
|
||||
_ "github.com/docker/machine/drivers/none"
|
||||
_ "github.com/docker/machine/drivers/virtualbox"
|
||||
"github.com/docker/machine/state"
|
||||
)
|
||||
|
||||
type DockerCli struct{}
|
||||
|
|
@ -93,6 +94,28 @@ func (cli *DockerCli) CmdHelp(args ...string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
type HostListItem struct {
|
||||
Name string
|
||||
Active bool
|
||||
DriverName string
|
||||
State state.State
|
||||
URL string
|
||||
}
|
||||
|
||||
type HostListItemByName []HostListItem
|
||||
|
||||
func (h HostListItemByName) Len() int {
|
||||
return len(h)
|
||||
}
|
||||
|
||||
func (h HostListItemByName) Swap(i, j int) {
|
||||
h[i], h[j] = h[j], h[i]
|
||||
}
|
||||
|
||||
func (h HostListItemByName) Less(i, j int) bool {
|
||||
return strings.ToLower(h[i].Name) < strings.ToLower(h[j].Name)
|
||||
}
|
||||
|
||||
func (cli *DockerCli) CmdLs(args ...string) error {
|
||||
cmd := cli.Subcmd("ls", "", "List machines")
|
||||
quiet := cmd.Bool([]string{"q", "-quiet"}, false, "Only display names")
|
||||
|
|
|
|||
24
host.go
24
host.go
|
|
@ -7,11 +7,9 @@ import (
|
|||
"os"
|
||||
"path"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/machine/drivers"
|
||||
"github.com/docker/machine/state"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -26,28 +24,6 @@ type Host struct {
|
|||
storePath string
|
||||
}
|
||||
|
||||
type HostListItem struct {
|
||||
Name string
|
||||
Active bool
|
||||
DriverName string
|
||||
State state.State
|
||||
URL string
|
||||
}
|
||||
|
||||
type HostListItemByName []HostListItem
|
||||
|
||||
func (h HostListItemByName) Len() int {
|
||||
return len(h)
|
||||
}
|
||||
|
||||
func (h HostListItemByName) Swap(i, j int) {
|
||||
h[i], h[j] = h[j], h[i]
|
||||
}
|
||||
|
||||
func (h HostListItemByName) Less(i, j int) bool {
|
||||
return strings.ToLower(h[i].Name) < strings.ToLower(h[j].Name)
|
||||
}
|
||||
|
||||
type hostConfig struct {
|
||||
DriverName string
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue