MCPcopy
hub / github.com/cli/cli / Shell

Function Shell

internal/codespaces/ssh.go:21–34  ·  view source on GitHub ↗

Shell runs an interactive secure shell over an existing port-forwarding session. It runs until the shell is terminated (including by cancellation of the context).

(
	ctx context.Context, p printer, sshArgs []string, command []string, port int, destination string, printConnDetails bool,
)

Source from the content-addressed store, hash-verified

19// port-forwarding session. It runs until the shell is terminated
20// (including by cancellation of the context).
21func Shell(
22 ctx context.Context, p printer, sshArgs []string, command []string, port int, destination string, printConnDetails bool,
23) error {
24 cmd, connArgs, err := newSSHCommand(ctx, port, destination, sshArgs, command)
25 if err != nil {
26 return fmt.Errorf("failed to create ssh command: %w", err)
27 }
28
29 if printConnDetails {
30 p.Printf("Connection Details: ssh %s %s", destination, connArgs)
31 }
32
33 return cmd.Run()
34}
35
36// Copy runs an scp command over the specified port. scpArgs should contain both scp flags
37// as well as the list of files to copy, with the flags first.

Callers 1

SSHMethod · 0.92

Calls 4

newSSHCommandFunction · 0.85
ErrorfMethod · 0.65
PrintfMethod · 0.65
RunMethod · 0.65

Tested by

no test coverage detected