mirror of https://github.com/docker/docs.git
Rename HostState struct to HostListItem
Signed-off-by: Guillaume Giamarchi <guillaume.giamarchi@gmail.com>
This commit is contained in:
parent
1547a48dde
commit
8797ca2d50
|
|
@ -116,7 +116,7 @@ func (cli *DockerCli) CmdLs(args ...string) error {
|
||||||
|
|
||||||
wg := sync.WaitGroup{}
|
wg := sync.WaitGroup{}
|
||||||
|
|
||||||
hostStateList := []HostState{}
|
hostListItem := []HostListItem{}
|
||||||
|
|
||||||
for _, host := range hostList {
|
for _, host := range hostList {
|
||||||
host := host
|
host := host
|
||||||
|
|
@ -145,7 +145,7 @@ func (cli *DockerCli) CmdLs(args ...string) error {
|
||||||
host.Name, err)
|
host.Name, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
hostStateList = append(hostStateList, HostState{
|
hostListItem = append(hostListItem, HostListItem{
|
||||||
Name: host.Name,
|
Name: host.Name,
|
||||||
Active: isActive,
|
Active: isActive,
|
||||||
DriverName: host.Driver.DriverName(),
|
DriverName: host.Driver.DriverName(),
|
||||||
|
|
@ -160,9 +160,9 @@ func (cli *DockerCli) CmdLs(args ...string) error {
|
||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
sort.Sort(HostStateByName(hostStateList))
|
sort.Sort(HostListItemByName(hostListItem))
|
||||||
|
|
||||||
for _, hostState := range hostStateList {
|
for _, hostState := range hostListItem {
|
||||||
activeString := ""
|
activeString := ""
|
||||||
if hostState.Active {
|
if hostState.Active {
|
||||||
activeString = "*"
|
activeString = "*"
|
||||||
|
|
|
||||||
10
host.go
10
host.go
|
|
@ -26,7 +26,7 @@ type Host struct {
|
||||||
storePath string
|
storePath string
|
||||||
}
|
}
|
||||||
|
|
||||||
type HostState struct {
|
type HostListItem struct {
|
||||||
Name string
|
Name string
|
||||||
Active bool
|
Active bool
|
||||||
DriverName string
|
DriverName string
|
||||||
|
|
@ -34,17 +34,17 @@ type HostState struct {
|
||||||
URL string
|
URL string
|
||||||
}
|
}
|
||||||
|
|
||||||
type HostStateByName []HostState
|
type HostListItemByName []HostListItem
|
||||||
|
|
||||||
func (h HostStateByName) Len() int {
|
func (h HostListItemByName) Len() int {
|
||||||
return len(h)
|
return len(h)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h HostStateByName) Swap(i, j int) {
|
func (h HostListItemByName) Swap(i, j int) {
|
||||||
h[i], h[j] = h[j], h[i]
|
h[i], h[j] = h[j], h[i]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h HostStateByName) Less(i, j int) bool {
|
func (h HostListItemByName) Less(i, j int) bool {
|
||||||
return strings.ToLower(h[i].Name) < strings.ToLower(h[j].Name)
|
return strings.ToLower(h[i].Name) < strings.ToLower(h[j].Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue