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

Commit fdb68ee

Browse files
committed
commands/version: Fix the number of arguments that can be passed
1 parent 021ffc8 commit fdb68ee

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

commands/version.go

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,21 @@
11
package commands
22

33
import (
4-
"fmt"
5-
64
"io"
75
"os"
86

97
"github.com/docker/machine/libmachine"
10-
"github.com/docker/machine/libmachine/mcndockerclient"
118
)
129

1310
func cmdVersion(c CommandLine, api libmachine.API) error {
1411
return printVersion(c, api, os.Stdout)
1512
}
1613

1714
func printVersion(c CommandLine, api libmachine.API, out io.Writer) error {
18-
if len(c.Args()) == 0 {
19-
c.ShowVersion()
20-
return nil
21-
}
22-
23-
if len(c.Args()) != 1 {
24-
return ErrExpectedOneMachine
25-
}
26-
27-
host, err := api.Load(c.Args().First())
28-
if err != nil {
29-
return err
30-
}
31-
32-
version, err := mcndockerclient.DockerVersion(host)
33-
if err != nil {
34-
return err
15+
if len(c.Args()) != 0 {
16+
return ErrTooManyArguments
3517
}
3618

37-
fmt.Fprintln(out, version)
38-
19+
c.ShowVersion()
3920
return nil
4021
}

0 commit comments

Comments
 (0)