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

Function parseExec

cli/command/container/exec.go:222–255  ·  view source on GitHub ↗

parseExec parses the specified args for the specified command and generates an ExecConfig from it.

(execOpts ExecOptions, configFile *configfile.ConfigFile)

Source from the content-addressed store, hash-verified

220// parseExec parses the specified args for the specified command and generates
221// an ExecConfig from it.
222func parseExec(execOpts ExecOptions, configFile *configfile.ConfigFile) (*client.ExecCreateOptions, error) {
223 execOptions := &client.ExecCreateOptions{
224 User: execOpts.User,
225 Privileged: execOpts.Privileged,
226 TTY: execOpts.TTY,
227 Cmd: execOpts.Command,
228 WorkingDir: execOpts.Workdir,
229 }
230
231 // collect all the environment variables for the container
232 var err error
233 if execOptions.Env, err = opts.ReadKVEnvStrings(execOpts.EnvFile.GetSlice(), execOpts.Env.GetSlice()); err != nil {
234 return nil, err
235 }
236
237 // If -d is not set, attach to everything by default
238 if !execOpts.Detach {
239 execOptions.AttachStdout = true
240 execOptions.AttachStderr = true
241 if execOpts.Interactive {
242 execOptions.AttachStdin = true
243 }
244 }
245
246 if execOpts.DetachKeys != "" {
247 execOptions.DetachKeys = execOpts.DetachKeys
248 } else {
249 execOptions.DetachKeys = configFile.DetachKeys
250 }
251 if err := validateDetachKeys(execOpts.DetachKeys); err != nil {
252 return nil, err
253 }
254 return execOptions, nil
255}

Callers 3

TestParseExecFunction · 0.85
TestParseExecErrorsFunction · 0.85
RunExecFunction · 0.85

Calls 2

validateDetachKeysFunction · 0.85
GetSliceMethod · 0.80

Tested by 2

TestParseExecFunction · 0.68
TestParseExecErrorsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…