MCPcopy Index your code
hub / github.com/dagger/dagger / cmd

Method cmd

cmd/dagger/shell_exec.go:316–338  ·  view source on GitHub ↗

cmd is the main logic for executing simple commands

(ctx context.Context, args []string, st *ShellState)

Source from the content-addressed store, hash-verified

314
315// cmd is the main logic for executing simple commands
316func (h *shellCallHandler) cmd(ctx context.Context, args []string, st *ShellState) (*ShellState, error) {
317 c, a := args[0], args[1:]
318
319 // First command in pipeline: e.g., `cmd1 | cmd2 | cmd3`
320 if st == nil {
321 return h.entrypointCall(ctx, c, a)
322 }
323
324 if h.Debug() {
325 shellDebug(ctx, "Stdin", c, a, st)
326 }
327
328 builtin, err := h.BuiltinCommand(c)
329 if err != nil {
330 return nil, err
331 }
332 if builtin != nil {
333 return nil, builtin.Execute(ctx, h, a, st)
334 }
335
336 // module or core function call
337 return h.functionCall(ctx, st, c, a)
338}
339
340// entrypointCall is executed when it's the first command in a pipeline
341func (h *shellCallHandler) entrypointCall(ctx context.Context, cmd string, args []string) (*ShellState, error) {

Callers 1

ExecMethod · 0.95

Calls 6

entrypointCallMethod · 0.95
DebugMethod · 0.95
BuiltinCommandMethod · 0.95
functionCallMethod · 0.95
shellDebugFunction · 0.85
ExecuteMethod · 0.45

Tested by

no test coverage detected