MCPcopy Index your code
hub / github.com/cli/cli / Copy

Function Copy

internal/codespaces/ssh.go:42–49  ·  view source on GitHub ↗

Copy runs an scp command over the specified port. scpArgs should contain both scp flags as well as the list of files to copy, with the flags first. Remote files indicated by a "remote:" prefix are resolved relative to the remote user's home directory, and are subject to shell expansion on the remot

(ctx context.Context, scpArgs []string, port int, destination string)

Source from the content-addressed store, hash-verified

40// to the remote user's home directory, and are subject to shell expansion
41// on the remote host; see https://lwn.net/Articles/835962/.
42func Copy(ctx context.Context, scpArgs []string, port int, destination string) error {
43 cmd, err := newSCPCommand(ctx, port, destination, scpArgs)
44 if err != nil {
45 return fmt.Errorf("failed to create scp command: %w", err)
46 }
47
48 return cmd.Run()
49}
50
51// NewRemoteCommand returns an exec.Cmd that will securely run a shell
52// command on the remote machine.

Callers 1

SSHMethod · 0.92

Calls 3

newSCPCommandFunction · 0.85
ErrorfMethod · 0.65
RunMethod · 0.65

Tested by

no test coverage detected