MCPcopy Index your code
hub / github.com/opencloud-eu/opencloud / ServiceCommand

Function ServiceCommand

opencloud/pkg/command/services.go:264–279  ·  view source on GitHub ↗

ServiceCommand composes a cobra command from the given inputs.

(cfg *config.Config, serviceName string, subCommands []*cobra.Command, f func(*config.Config))

Source from the content-addressed store, hash-verified

262
263// ServiceCommand composes a cobra command from the given inputs.
264func ServiceCommand(cfg *config.Config, serviceName string, subCommands []*cobra.Command, f func(*config.Config)) *cobra.Command {
265 command := &cobra.Command{
266 Use: serviceName,
267 Short: fmt.Sprintf("%s service commands", serviceName),
268 GroupID: CommandGroupServices,
269 PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
270 configlog.Error(parser.ParseConfig(cfg, true))
271 f(cfg)
272 return nil
273 },
274 }
275
276 command.AddCommand(subCommands...)
277
278 return command
279}
280
281func init() {
282 for _, c := range serviceCommands {

Callers 1

services.goFile · 0.85

Calls 2

ErrorFunction · 0.92
ParseConfigFunction · 0.92

Tested by

no test coverage detected