MCPcopy
hub / github.com/dagger/dagger / GetDef

Method GetDef

cmd/dagger/shell_exec.go:997–1011  ·  view source on GitHub ↗

GetDef returns the type definitions for a given state This is the main getter function for a module definition.

(st *ShellState)

Source from the content-addressed store, hash-verified

995//
996// This is the main getter function for a module definition.
997func (h *shellCallHandler) GetDef(st *ShellState) *moduleDef {
998 dig := h.modDigest()
999
1000 if st != nil && st.ModDigest != "" && st.ModDigest != dig {
1001 dig = st.ModDigest
1002 }
1003
1004 if def := h.loadModDef(dig); def != nil {
1005 return def
1006 }
1007
1008 // Every time the default module ref is set, there should be a corresponding
1009 // value in h.modDefs. Otherwise there's a bug in the CLI.
1010 panic(fmt.Sprintf("module %q not loaded", dig))
1011}
1012
1013func (h *shellCallHandler) GetDependency(ctx context.Context, name string) (*ShellState, *moduleDef, error) {
1014 modDef := h.GetDef(nil)

Callers 10

entrypointCallMethod · 0.95
StateLookupMethod · 0.95
functionCallMethod · 0.95
StateResultMethod · 0.95
GetDependencyMethod · 0.95
registerCommandsMethod · 0.95
PromptMethod · 0.95
MainHelpMethod · 0.95
TypesHelpMethod · 0.95

Calls 2

modDigestMethod · 0.95
loadModDefMethod · 0.95

Tested by

no test coverage detected