Documentation
¶
Index ¶
- func BoolFlagBeforeDash(args []string, long, shorthand string) bool
- func ConfiguredRemote(dir, name string) (config.Remote, error)
- func ProfileArgs(profile config.Remote) []string
- func RunRemoteInvocation(ctx context.Context, invocation Invocation, streams IO) error
- func ShellQuote(value string) string
- func ValidateRemoteCommand(args []string) error
- func ValidateRemoteState(state string) error
- func ValidateRemoteTarget(target string) error
- type IO
- type IOContextKey
- type Invocation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BoolFlagBeforeDash ¶
BoolFlagBeforeDash mirrors pflag's boolean forms closely enough to choose the SSH TTY mode before the remote Cobra command parses the arguments. Repeated flags use the last value, and agent arguments after -- are never inspected.
func ProfileArgs ¶ added in v0.149.4
ProfileArgs is literal local CLI argv; RunRemoteInvocation alone quotes it for the receiving POSIX shell. Labels and remote paths never become shell source.
func RunRemoteInvocation ¶
func RunRemoteInvocation(ctx context.Context, invocation Invocation, streams IO) error
func ShellQuote ¶
ShellQuote quotes one argument for the remote user's POSIX shell. OpenSSH combines the remote command into a shell string even when local argv is safe.
func ValidateRemoteCommand ¶
func ValidateRemoteState ¶
ValidateRemoteState accepts only a POSIX absolute path for the remote host. It deliberately avoids filepath.Abs, Clean, and EvalSymlinks: the client's filesystem says nothing about the remote one, and the receiving executable applies its own overlap, alias, and channel-marker checks before any write.
As with --remote-binary, NUL cannot reach an environment value, and CR or LF would split the one-line remote command for SSH logs and non-POSIX login shells. Every other byte, including tab and other control bytes, is legal in a POSIX path and stays inert inside the single-quoted assignment, so it is passed through literally.
func ValidateRemoteTarget ¶
Types ¶
type IO ¶
type IOContextKey ¶
type IOContextKey struct{}
type Invocation ¶
type Invocation struct {
Target string
Binary string
CWD string
State string
Args []string
AllocateTTY bool
// NonInteractive prevents SSH from prompting via /dev/tty in background work.
NonInteractive bool
}
Invocation.State is a lexical absolute path on the remote host. It is never resolved locally: the receiving executable owns its own state checks.
func ParseRemoteInvocation ¶
func ProfileInvocation ¶ added in v0.149.4
func ProfileInvocation(profile config.Remote, args []string) Invocation
ProfileInvocation preserves the saved host, executable and remote state. The receiving binary still applies the channel guard and attachment authorization.