File tree Expand file tree Collapse file tree 6 files changed +40
-4
lines changed
Expand file tree Collapse file tree 6 files changed +40
-4
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,11 @@ var funcMap = template.FuncMap{
2323}
2424
2525func cmdInspect (c * cli.Context ) {
26+ if len (c .Args ()) == 0 {
27+ cli .ShowCommandHelp (c , "inspect" )
28+ log .Fatal ("You must specify a machine name" )
29+ }
30+
2631 tmplString := c .String ("format" )
2732 if tmplString != "" {
2833 var tmpl * template.Template
Original file line number Diff line number Diff line change 11package commands
22
33import (
4- "github.com/docker/machine/libmachine/log"
5-
64 "github.com/codegangsta/cli"
5+ "github.com/docker/machine/libmachine/log"
76)
87
98func cmdStatus (c * cli.Context ) {
9+ if len (c .Args ()) != 1 {
10+ log .Fatal (ErrExpectedOneMachine )
11+ }
1012 host := getFirstArgHost (c )
1113 currentState , err := host .Driver .GetState ()
1214 if err != nil {
Original file line number Diff line number Diff line change @@ -3,12 +3,14 @@ package commands
33import (
44 "fmt"
55
6- "github.com/docker/machine/libmachine/log"
7-
86 "github.com/codegangsta/cli"
7+ "github.com/docker/machine/libmachine/log"
98)
109
1110func cmdUrl (c * cli.Context ) {
11+ if len (c .Args ()) != 1 {
12+ log .Fatal (ErrExpectedOneMachine )
13+ }
1214 url , err := getFirstArgHost (c ).GetURL ()
1315 if err != nil {
1416 log .Fatal (err )
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bats
2+
3+ load ${BASE_TEST_DIR} /helpers.bash
4+
5+ @test " inspect: show error in case of no args" {
6+ run machine inspect
7+ [ " $status " -eq 1 ]
8+ [[ ${output} == * " must specify a machine name" * ]]
9+ }
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bats
2+
3+ load ${BASE_TEST_DIR} /helpers.bash
4+
5+ @test " status: show error in case of no args" {
6+ run machine inspect
7+ [ " $status " -eq 1 ]
8+ [[ ${output} == * " must specify a machine name" * ]]
9+ }
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bats
2+
3+ load ${BASE_TEST_DIR} /helpers.bash
4+
5+ @test " url: show error in case of no args" {
6+ run machine inspect
7+ [ " $status " -eq 1 ]
8+ [[ ${output} == * " must specify a machine name" * ]]
9+ }
You can’t perform that action at this time.
0 commit comments