mirror of https://github.com/docker/docs.git
Add argument assertion to inspect/status/url commands
Signed-off-by: Kazuyuki Suzuki <kechol28@gmail.com>
This commit is contained in:
parent
1588f2217a
commit
2bc53a6ac3
|
@ -23,6 +23,11 @@ var funcMap = template.FuncMap{
|
|||
}
|
||||
|
||||
func cmdInspect(c *cli.Context) {
|
||||
if len(c.Args()) == 0 {
|
||||
cli.ShowCommandHelp(c, "inspect")
|
||||
log.Fatal("You must specify a machine name")
|
||||
}
|
||||
|
||||
tmplString := c.String("format")
|
||||
if tmplString != "" {
|
||||
var tmpl *template.Template
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
package commands
|
||||
|
||||
import (
|
||||
"github.com/docker/machine/libmachine/log"
|
||||
|
||||
"github.com/codegangsta/cli"
|
||||
"github.com/docker/machine/libmachine/log"
|
||||
)
|
||||
|
||||
func cmdStatus(c *cli.Context) {
|
||||
if len(c.Args()) != 1 {
|
||||
log.Fatal(ErrExpectedOneMachine)
|
||||
}
|
||||
host := getFirstArgHost(c)
|
||||
currentState, err := host.Driver.GetState()
|
||||
if err != nil {
|
||||
|
|
|
@ -3,12 +3,14 @@ package commands
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/docker/machine/libmachine/log"
|
||||
|
||||
"github.com/codegangsta/cli"
|
||||
"github.com/docker/machine/libmachine/log"
|
||||
)
|
||||
|
||||
func cmdUrl(c *cli.Context) {
|
||||
if len(c.Args()) != 1 {
|
||||
log.Fatal(ErrExpectedOneMachine)
|
||||
}
|
||||
url, err := getFirstArgHost(c).GetURL()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env bats
|
||||
|
||||
load ${BASE_TEST_DIR}/helpers.bash
|
||||
|
||||
@test "inspect: show error in case of no args" {
|
||||
run machine inspect
|
||||
[ "$status" -eq 1 ]
|
||||
[[ ${output} == *"must specify a machine name"* ]]
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env bats
|
||||
|
||||
load ${BASE_TEST_DIR}/helpers.bash
|
||||
|
||||
@test "status: show error in case of no args" {
|
||||
run machine inspect
|
||||
[ "$status" -eq 1 ]
|
||||
[[ ${output} == *"must specify a machine name"* ]]
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env bats
|
||||
|
||||
load ${BASE_TEST_DIR}/helpers.bash
|
||||
|
||||
@test "url: show error in case of no args" {
|
||||
run machine inspect
|
||||
[ "$status" -eq 1 ]
|
||||
[[ ${output} == *"must specify a machine name"* ]]
|
||||
}
|
Loading…
Reference in New Issue