()
| 570 | } |
| 571 | |
| 572 | func (b CommandBuilder) createConfigCommand() *CommandDefinition { |
| 573 | const flagNameAuth = "auth" |
| 574 | |
| 575 | flags := NewFlagBuilder(). |
| 576 | AddFlag(NewFlag(flagNameAuth, fmt.Sprintf("Authorization type: %s, %s, %s", config.AuthTypeCredentials, config.AuthTypeLogin, config.AuthTypePat), FlagTypeString)). |
| 577 | AddFlag(NewFlag(FlagNameProfile, "Profile to configure", FlagTypeString). |
| 578 | WithEnvVarName("UIPATH_PROFILE"). |
| 579 | WithDefaultValue(config.DefaultProfile)). |
| 580 | AddHelpFlag(). |
| 581 | Build() |
| 582 | |
| 583 | subcommands := []*CommandDefinition{ |
| 584 | b.createConfigSetCommand(), |
| 585 | b.createCacheCommand(), |
| 586 | b.createOfflineCommand(), |
| 587 | } |
| 588 | |
| 589 | return NewCommand("config", "Interactive Configuration", "Interactive command to configure the CLI"). |
| 590 | WithFlags(flags). |
| 591 | WithSubcommands(subcommands). |
| 592 | WithAction(func(context *CommandExecContext) error { |
| 593 | auth := context.String(flagNameAuth) |
| 594 | profileName := context.String(FlagNameProfile) |
| 595 | handler := newConfigCommandHandler(b.StdIn, b.StdOut, b.ConfigProvider) |
| 596 | return handler.Configure(auth, profileName) |
| 597 | }) |
| 598 | } |
| 599 | |
| 600 | func (b CommandBuilder) createConfigSetCommand() *CommandDefinition { |
| 601 | const flagNameKey = "key" |
no test coverage detected