MCPcopy Create free account
hub / github.com/UiPath/uipathcli / createServiceCommand

Method createServiceCommand

commandline/command_builder.go:467–494  ·  view source on GitHub ↗
(definition parser.Definition)

Source from the content-addressed store, hash-verified

465}
466
467func (b CommandBuilder) createServiceCommand(definition parser.Definition) *CommandDefinition {
468 categories := map[string]*CommandDefinition{}
469 commands := []*CommandDefinition{}
470 for _, operation := range definition.Operations {
471 if operation.Category == nil {
472 command := b.createOperationCommand(operation)
473 commands = append(commands, command)
474 continue
475 }
476 isNewCategory, command := b.createServiceCommandCategory(operation, categories)
477 if isNewCategory {
478 commands = append(commands, command)
479 }
480 }
481 b.sort(commands)
482 for _, command := range commands {
483 b.sort(command.Subcommands)
484 }
485
486 flags := NewFlagBuilder().
487 AddHelpFlag().
488 AddServiceVersionFlag(true).
489 Build()
490
491 return NewCommand(definition.Name, definition.Summary, definition.Description).
492 WithFlags(flags).
493 WithSubcommands(commands)
494}
495
496func (b CommandBuilder) createAutoCompleteEnableCommand() *CommandDefinition {
497 const shellFlagName = "shell"

Callers 1

createServiceCommandsMethod · 0.95

Calls 10

sortMethod · 0.95
NewFlagBuilderFunction · 0.85
AddServiceVersionFlagMethod · 0.80
AddHelpFlagMethod · 0.80
WithSubcommandsMethod · 0.80
WithFlagsMethod · 0.80
NewCommandFunction · 0.70
BuildMethod · 0.45

Tested by

no test coverage detected