From e2e4f70f6b14d46d7dbbd2e0d5e7c3c3c69b47cc Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Fri, 18 Oct 2024 14:07:53 -0500 Subject: Initial commit Signed-off-by: Matt Strapp --- run_nonhost.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 run_nonhost.go (limited to 'run_nonhost.go') diff --git a/run_nonhost.go b/run_nonhost.go new file mode 100644 index 0000000..9742774 --- /dev/null +++ b/run_nonhost.go @@ -0,0 +1,18 @@ +//go:build !windows || nonhost + +package main + +import ( + "errors" + "fmt" + "os/exec" + "strconv" +) + +func command(distribution Distribution, config Config) (*exec.Cmd, error) { + if distribution.Username == "" || distribution.Port == 0 { + return nil, errors.New("SSH username or port not set, not running.") + } + args := append([]string{fmt.Sprintf("%s@%s", distribution.Username, config.HostIP), "-p", strconv.Itoa(distribution.Port)}, config.SshArgs...) + return exec.Command("ssh", args...), nil +} -- cgit v1.2.3