Add status command
closes #1471 by adding the status command that prints the state of a machine. Signed-off-by: Sergio Botero <sergiobuj@gmail.com>
This commit is contained in:
@@ -379,6 +379,12 @@ var Commands = []cli.Command{
|
||||
Description: "Argument(s) are one or more machine names.",
|
||||
Action: cmdStart,
|
||||
},
|
||||
{
|
||||
Name: "status",
|
||||
Usage: "Get the status of a machine",
|
||||
Description: "Argument is a machine name.",
|
||||
Action: cmdStatus,
|
||||
},
|
||||
{
|
||||
Name: "stop",
|
||||
Usage: "Stop a machine",
|
||||
|
||||
18
commands/status.go
Normal file
18
commands/status.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/docker/machine/log"
|
||||
|
||||
"github.com/codegangsta/cli"
|
||||
)
|
||||
|
||||
func cmdStatus(c *cli.Context) {
|
||||
host := getHost(c)
|
||||
currentState, err := host.Driver.GetState()
|
||||
if err != nil {
|
||||
log.Errorf("error getting state for host %s: %s", host.Name, err)
|
||||
}
|
||||
fmt.Println(currentState)
|
||||
}
|
||||
1
commands/status_test.go
Normal file
1
commands/status_test.go
Normal file
@@ -0,0 +1 @@
|
||||
package commands
|
||||
@@ -27,6 +27,7 @@ parent="smn_machine_ref"
|
||||
* [scp](scp.md)
|
||||
* [ssh](ssh.md)
|
||||
* [start](start.md)
|
||||
* [status](status.md)
|
||||
* [stop](stop.md)
|
||||
* [upgrade](upgrade.md)
|
||||
* [url](url.md)
|
||||
* [url](url.md)
|
||||
|
||||
18
docs/reference/status.md
Normal file
18
docs/reference/status.md
Normal file
@@ -0,0 +1,18 @@
|
||||
<!--[metadata]>
|
||||
+++
|
||||
title = "status"
|
||||
description = "Get the status of a machine"
|
||||
keywords = ["machine, status, subcommand"]
|
||||
[menu.main]
|
||||
parent="smn_machine_subcmds"
|
||||
+++
|
||||
<![end-metadata]-->
|
||||
|
||||
# status
|
||||
|
||||
Get the status of a machine.
|
||||
|
||||
```
|
||||
$ docker-machine status dev
|
||||
Running
|
||||
```
|
||||
Reference in New Issue
Block a user