MCPcopy Create free account
hub / github.com/goadesign/goa / BuildCommandData

Function BuildCommandData

codegen/cli/cli.go:161–182  ·  view source on GitHub ↗

BuildCommandData builds the data needed by CLI code generators to render the parsing of the service command.

(data *service.Data)

Source from the content-addressed store, hash-verified

159// BuildCommandData builds the data needed by CLI code generators to render the
160// parsing of the service command.
161func BuildCommandData(data *service.Data) *CommandData {
162 description := data.Description
163 if description == "" {
164 description = fmt.Sprintf("Make requests to the %q service", data.Name)
165 }
166
167 var interceptors *InterceptorData
168 if len(data.ClientInterceptors) > 0 {
169 interceptors = &InterceptorData{
170 VarName: codegen.Goify(data.Name, false) + "Inter",
171 PkgName: data.PkgName,
172 }
173 }
174
175 return &CommandData{
176 Name: codegen.KebabCase(data.Name),
177 VarName: codegen.Goify(data.Name, false),
178 Description: description,
179 PkgName: data.PkgName + "c",
180 Interceptors: interceptors,
181 }
182}
183
184// BuildSubcommandData builds the data needed by CLI code generators to render
185// the CLI parsing of the service sub-command.

Callers 2

ClientCLIFilesFunction · 0.92
ClientCLIFilesFunction · 0.92

Calls 2

GoifyFunction · 0.92
KebabCaseFunction · 0.92

Tested by

no test coverage detected