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

Function functionListRun

cmd/dagger/call.go:97–130  ·  view source on GitHub ↗
(o functionProvider, writer io.Writer, errWriter io.Writer)

Source from the content-addressed store, hash-verified

95}
96
97func functionListRun(o functionProvider, writer io.Writer, errWriter io.Writer) error {
98 fns, skipped, err := GetSupportedFunctions(o)
99 if err != nil {
100 return err
101 }
102
103 if len(fns) == 0 {
104 fmt.Fprintln(errWriter, "No functions found.")
105 return nil
106 }
107
108 tw := tabwriter.NewWriter(writer, 0, 0, 3, ' ', tabwriter.DiscardEmptyColumns)
109 fmt.Fprintf(tw, "%s\t%s\n",
110 termenv.String("Name").Bold(),
111 termenv.String("Description").Bold(),
112 )
113 // List functions on the final object
114 sort.Slice(fns, func(i, j int) bool {
115 return fns[i].Name < fns[j].Name
116 })
117 for _, fn := range fns {
118 fmt.Fprintf(tw, "%s\t%s\n",
119 fn.CmdName(),
120 fn.Short(),
121 )
122 }
123 if len(skipped) > 0 {
124 msg := fmt.Sprintf("Skipped %d function(s) with unsupported types: %s", len(skipped), strings.Join(skipped, ", "))
125 fmt.Fprintf(tw, "\n%s\n",
126 termenv.String(msg).Faint().String(),
127 )
128 }
129 return tw.Flush()
130}

Callers 1

call.goFile · 0.85

Calls 5

GetSupportedFunctionsFunction · 0.85
CmdNameMethod · 0.80
StringMethod · 0.65
ShortMethod · 0.65
FlushMethod · 0.45

Tested by

no test coverage detected