jx/internal/command/sshcommand.go
Matthew Rich 94f3998fcd
Some checks failed
Declarative Tests / test (push) Waiting to run
Lint / golangci-lint (push) Has been cancelled
add support for remote command execution
2024-11-10 10:16:44 -08:00

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
}