MCPcopy Index your code
hub / github.com/docker/cli / Command

Method Command

cli/connhelper/ssh/ssh.go:146–162  ·  view source on GitHub ↗

Command returns the ssh flags and arguments to execute a command (remoteCommandAndArgs) on the remote host. Where needed, it quotes values passed in remoteCommandAndArgs to account for ssh executing the remote command in a shell. It returns an error if no remote command is passed, or when unable to

(sshFlags []string, remoteCommandAndArgs ...string)

Source from the content-addressed store, hash-verified

144// perform sanitization or quoting on the sshFlags and callers are expected
145// to sanitize this argument.
146func (sp *Spec) Command(sshFlags []string, remoteCommandAndArgs ...string) ([]string, error) {
147 if len(remoteCommandAndArgs) == 0 {
148 return nil, errors.New("no remote command specified")
149 }
150 sshArgs, err := sp.args(sshFlags...)
151 if err != nil {
152 return nil, err
153 }
154 remoteCommand, err := quoteCommand(remoteCommandAndArgs...)
155 if err != nil {
156 return nil, err
157 }
158 if remoteCommand != "" {
159 sshArgs = append(sshArgs, remoteCommand)
160 }
161 return sshArgs, nil
162}
163
164// quoteCommand returns the remote command to run using the ssh connection
165// as a single string, quoting values where needed because ssh executes

Callers 15

getConnectionHelperFunction · 0.95
MetadataMethod · 0.45
PluginRunCommandFunction · 0.45
TestCommandFunction · 0.45
generateAppFunction · 0.45
SkipIfDaemonNotLinuxFunction · 0.45
SkipIfNotPlatformFunction · 0.45
DaemonAPIVersionFunction · 0.45
TestAttachExitCodeFunction · 0.45
TestAttachInterruptFunction · 0.45

Calls 2

argsMethod · 0.95
quoteCommandFunction · 0.85

Tested by 15

TestCommandFunction · 0.36
TestAttachExitCodeFunction · 0.36
TestAttachInterruptFunction · 0.36
TestSigProxyWithTTYFunction · 0.36
TestKillContainerFunction · 0.36
TestRunAttachFunction · 0.36
TestProcessTerminationFunction · 0.36
TestOauthLoginFunction · 0.36
TestCreatePushPullFunction · 0.36