From b44db203350d91e952730f0000ccd8fc8b16b648 Mon Sep 17 00:00:00 2001 From: Simon Thulbourn Date: Fri, 12 Dec 2014 17:00:45 +0000 Subject: [PATCH] implements a -c/--command flag for ssh Signed-off-by: Simon Thulbourn --- commands.go | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/commands.go b/commands.go index 62180892f2..fed2c1be72 100644 --- a/commands.go +++ b/commands.go @@ -41,15 +41,6 @@ func (h HostListItemByName) Less(i, j int) bool { return strings.ToLower(h[i].Name) < strings.ToLower(h[j].Name) } -func BeforeHandler(c *cli.Context) error { - // if c.Bool("debug") { - // os.Setenv("DEBUG", "1") - // initLogging(log.DebugLevel) - // } - - return nil -} - var Commands = []cli.Command{ { Name: "active", @@ -119,8 +110,6 @@ var Commands = []cli.Command{ store := NewStore() - fmt.Printf("%#v", c.String("url")) - host, err := store.Create(name, driver, c) if err != nil { log.Errorf("%s", err) @@ -349,6 +338,13 @@ var Commands = []cli.Command{ }, }, { + Flags: []cli.Flag{ + cli.StringFlag{ + Name: "command, c", + Usage: "SSH Command", + Value: "", + }, + }, Name: "ssh", Usage: "Log into or run a command on a machine with SSH", Action: func(c *cli.Context) { @@ -376,7 +372,7 @@ var Commands = []cli.Command{ os.Exit(1) } - sshCmd, err := host.Driver.GetSSHCommand(os.Args[i:]...) + sshCmd, err := host.Driver.GetSSHCommand(c.String("command")) if err != nil { log.Errorf("%s", err) os.Exit(1)