Skip to content
This repository was archived by the owner on Dec 17, 2021. It is now read-only.

Commit c4f3857

Browse files
committed
commands/status: Add
1 parent ddf5b9f commit c4f3857

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

commands/status.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package commands
2+
3+
import (
4+
"fmt"
5+
"github.com/docker/machine/libmachine"
6+
"github.com/docker/machine/libmachine/log"
7+
)
8+
9+
func cmdStatus(c CommandLine, api libmachine.API) error {
10+
if len(c.Args()) > 1 {
11+
return ErrExpectedOneMachine
12+
}
13+
14+
target, err := targetHost(c, api)
15+
if err != nil {
16+
return err
17+
}
18+
19+
host, err := api.Load(target)
20+
if err != nil {
21+
return err
22+
}
23+
24+
currentState, err := host.Driver.GetState()
25+
if err != nil {
26+
return fmt.Errorf("error getting state for host %s: %s", host.Name, err)
27+
}
28+
29+
log.Info(currentState)
30+
31+
return nil
32+
}

0 commit comments

Comments
 (0)