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

Method functionCall

cmd/dagger/shell_exec.go:435–464  ·  view source on GitHub ↗

functionCall is executed for every command that the exec handler processes

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

Source from the content-addressed store, hash-verified

433
434// functionCall is executed for every command that the exec handler processes
435func (h *shellCallHandler) functionCall(ctx context.Context, st *ShellState, name string, args []string) (*ShellState, error) {
436 def := h.GetDef(st)
437 call := st.Function()
438
439 fn, err := call.GetNextDef(def, name)
440 // If the current value is typed as an interface, the next command may be
441 // provided by its concrete implementation rather than the interface itself.
442 // Ask GraphQL for the concrete __typename and continue through an inline
443 // fragment so we don't have to invent some sort of inline fragment shell
444 // syntax.
445 if err != nil && def.GetInterface(call.ReturnObject) != nil {
446 st, err = h.resolveConcreteReturnObject(ctx, st)
447 if err == nil {
448 call = st.Function()
449 fn, err = call.GetNextDef(def, name)
450 }
451 }
452 if err != nil {
453 return st, err
454 }
455
456 argValues, err := h.parseArgumentValues(ctx, def, fn, args)
457 if err != nil {
458 return st, fmt.Errorf("function %q: %w", fn.CmdName(), err)
459 }
460
461 newSt := st.WithCall(fn, argValues)
462
463 return &newSt, nil
464}
465
466func (h *shellCallHandler) resolveConcreteReturnObject(ctx context.Context, st *ShellState) (*ShellState, error) {
467 call := st.Function()

Callers 2

cmdMethod · 0.95
entrypointCallMethod · 0.95

Calls 8

GetDefMethod · 0.95
parseArgumentValuesMethod · 0.95
GetNextDefMethod · 0.80
GetInterfaceMethod · 0.80
CmdNameMethod · 0.80
WithCallMethod · 0.80
FunctionMethod · 0.45

Tested by

no test coverage detected