Skip to content

Commit c7aafd4

Browse files
authored
Merge pull request #364 from roots/fix-ssh-flags
Fix ssh cmd flags
2 parents a0f6468 + c99e5e6 commit c7aafd4

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

cmd/ssh.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ func (c *SshCommand) Run(args []string) int {
3737
return 1
3838
}
3939

40+
if err := c.flags.Parse(args); err != nil {
41+
return 1
42+
}
43+
44+
args = c.flags.Args()
45+
4046
commandArgumentValidator := &CommandArgumentValidator{required: 1, optional: 1}
4147
commandArgumentErr := commandArgumentValidator.validate(args)
4248
if commandArgumentErr != nil {

cmd/ssh_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ func TestSshRun(t *testing.T) {
107107
"ssh vagrant@example.test",
108108
0,
109109
},
110+
{
111+
"production_with_user_flag",
112+
[]string{"-u=web", "production"},
113+
"ssh web@example.com",
114+
0,
115+
},
110116
}
111117

112118
for _, tc := range cases {

0 commit comments

Comments
 (0)