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

Method selectWith

cmd/dagger/functions.go:549–569  ·  view source on GitHub ↗

selectWith adds a `with(args...)` selection to the query builder if any constructor flags were set.

(cmd *cobra.Command)

Source from the content-addressed store, hash-verified

547// selectWith adds a `with(args...)` selection to the query builder if any
548// constructor flags were set.
549func (fc *FuncCommand) selectWith(cmd *cobra.Command) error {
550 if fc.withFn == nil {
551 return nil
552 }
553 // Check if any with-args flags were changed.
554 anyChanged := false
555 for _, a := range fc.withFn.SupportedArgs() {
556 flag, err := a.GetFlag(cmd.Flags())
557 if err != nil {
558 continue
559 }
560 if flag.Changed {
561 anyChanged = true
562 break
563 }
564 }
565 if !anyChanged {
566 return nil
567 }
568 return fc.selectFunc(fc.withFn, cmd)
569}
570
571// addFlagsForFunction creates the flags for a function's arguments.
572func (fc *FuncCommand) addFlagsForFunction(cmd *cobra.Command, fn *modFunction) error {

Callers 1

cobraBuilderMethod · 0.95

Calls 3

selectFuncMethod · 0.95
SupportedArgsMethod · 0.80
GetFlagMethod · 0.80

Tested by

no test coverage detected