Skip to content

Commit 15a30be

Browse files
committed
pkg/ssh: export some functions and fields
Signed-off-by: Akihiro Suda <[email protected]>
1 parent 6a34bbc commit 15a30be

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

pkg/ssh/ssh.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ import (
1313
)
1414

1515
type SSHConfig struct {
16-
ConfigFile string
17-
Persist bool
16+
ConfigFile string
17+
Persist bool
18+
AdditionalArgs []string
1819
}
1920

2021
func (c *SSHConfig) Binary() string {
@@ -34,6 +35,7 @@ func (c *SSHConfig) Args() []string {
3435
"-o", "ControlPersist=yes",
3536
)
3637
}
38+
args = append(args, c.AdditionalArgs...)
3739
return args
3840
}
3941

@@ -53,9 +55,9 @@ func ExitMaster(host string, port int, c *SSHConfig) error {
5355
return nil
5456
}
5557

56-
// parseScriptInterpreter extracts "#!/bin/sh" interpreter string from the script.
58+
// ParseScriptInterpreter extracts "#!/bin/sh" interpreter string from the script.
5759
// The result does not contain the "#!" prefix.
58-
func parseScriptInterpreter(script string) (string, error) {
60+
func ParseScriptInterpreter(script string) (string, error) {
5961
r := bufio.NewReader(strings.NewReader(script))
6062
firstLine, partial, err := r.ReadLine()
6163
if err != nil {
@@ -82,7 +84,7 @@ func ExecuteScript(host string, port int, c *SSHConfig, script, scriptName strin
8284
if c == nil {
8385
return "", "", errors.New("got nil SSHConfig")
8486
}
85-
interpreter, err := parseScriptInterpreter(script)
87+
interpreter, err := ParseScriptInterpreter(script)
8688
if err != nil {
8789
return "", "", err
8890
}

pkg/ssh/ssh_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ echo "Hello world"
2121
},
2222
}
2323
for i, tc := range testCases {
24-
got, err := parseScriptInterpreter(tc.script)
24+
got, err := ParseScriptInterpreter(tc.script)
2525
if tc.expected != "" {
2626
if err != nil {
2727
t.Errorf("#%d: %v", i, err)

0 commit comments

Comments
 (0)