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

Method FunctionUseLine

cmd/dagger/shell_help.go:253–273  ·  view source on GitHub ↗

FunctionUseLine returns the usage line fine for a function

(md *moduleDef, fn *modFunction)

Source from the content-addressed store, hash-verified

251
252// FunctionUseLine returns the usage line fine for a function
253func (h *shellCallHandler) FunctionUseLine(md *moduleDef, fn *modFunction) string {
254 sb := new(strings.Builder)
255
256 if fn == md.MainObject.AsObject.Constructor {
257 sb.WriteString(h.modRelPath(md))
258 } else {
259 sb.WriteString(fn.CmdName())
260 }
261
262 for _, arg := range fn.RequiredArgs() {
263 sb.WriteString(" <")
264 sb.WriteString(arg.FlagName())
265 sb.WriteString(">")
266 }
267
268 if len(fn.OptionalArgs()) > 0 {
269 sb.WriteString(" [options]")
270 }
271
272 return sb.String()
273}
274
275func (h *shellCallHandler) FunctionFullUseLine(md *moduleDef, fn *modFunction) string {
276 usage := h.FunctionUseLine(md, fn)

Callers 3

FunctionFullUseLineMethod · 0.95
ModuleDocMethod · 0.95
FunctionDocMethod · 0.95

Calls 6

modRelPathMethod · 0.95
CmdNameMethod · 0.80
RequiredArgsMethod · 0.80
FlagNameMethod · 0.80
OptionalArgsMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected