diff --git a/commands.go b/commands.go index d9a21d3e8e..0b62e080c1 100644 --- a/commands.go +++ b/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") diff --git a/host.go b/host.go index 03adb808fc..aa3476034b 100644 --- a/host.go +++ b/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 }