55 lines
1006 B
Go
55 lines
1006 B
Go
|
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
|
||
|
|
||
|
package command
|
||
|
|
||
|
import (
|
||
|
"io"
|
||
|
"os"
|
||
|
"log/slog"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
)
|
||
|
|
||
|
type SSHCommandProvider struct {
|
||
|
Env []string
|
||
|
Stdin io.Reader
|
||
|
}
|
||
|
|
||
|
// Consturct a new ssh exec
|
||
|
func NewSSHProvider(c *Command, value any) (p *SSHCommandProvider) {
|
||
|
if args, err := c.Template(value); err == nil {
|
||
|
slog.Info("command.NewSSHProvider", "command", c.Path, "args", args, "target", c.TargetRef)
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (s *SSHCommandProvider) Start() error {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (s *SSHCommandProvider) Wait() error {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (s *SSHCommandProvider) StdinPipe() (w io.WriteCloser, err error) {
|
||
|
return
|
||
|
}
|
||
|
|
||
|
func (s *SSHCommandProvider) StdoutPipe() (r io.ReadCloser, err error) {
|
||
|
return
|
||
|
}
|
||
|
|
||
|
func (s *SSHCommandProvider) StderrPipe() (r io.ReadCloser, err error) {
|
||
|
return
|
||
|
}
|
||
|
|
||
|
func (s *SSHCommandProvider) SetCmdEnv(env []string) {
|
||
|
s.Env = append(os.Environ(), env...)
|
||
|
}
|
||
|
|
||
|
func (s *SSHCommandProvider) SetStdin(r io.Reader) {
|
||
|
s.Stdin = r
|
||
|
}
|
||
|
|