BuildCommandData builds the data needed by CLI code generators to render the parsing of the service command.
(data *service.Data)
| 159 | // BuildCommandData builds the data needed by CLI code generators to render the |
| 160 | // parsing of the service command. |
| 161 | func 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. |
no test coverage detected