feat: server add command

Interacts with and stores infomaton in the docker store at ~/.docker

Equivalent to docker context add
This commit is contained in:
2021-07-22 12:48:14 +01:00
parent 5e94050865
commit fc7dade6f8
2 changed files with 87 additions and 0 deletions

View File

@ -58,6 +58,18 @@ var serverAddCommand = &cli.Command{
Usage: "Add a server, reachable on <host>.",
ArgsUsage: "<host> [<user>] [<port>]",
Description: "[<user>], [<port>] SSH connection details",
Action: func(c *cli.Context) error {
arg_len := c.Args().Len()
args := c.Args().Slice()
if arg_len < 3 {
args = append(args, make([]string, 3-arg_len)...)
}
if err := client.CreateContext(args[0], args[1], args[2]); err != nil {
logrus.Fatal(err)
}
fmt.Println(args[0])
return nil
},
}
var serverNewCommand = &cli.Command{