diff --git a/plugins/components/conversionlayer.go b/plugins/components/conversionlayer.go index a34da13a5..be0fdccb2 100644 --- a/plugins/components/conversionlayer.go +++ b/plugins/components/conversionlayer.go @@ -7,7 +7,6 @@ import ( "github.com/jfrog/gofrog/datastructures" "github.com/jfrog/jfrog-cli-core/v2/docs/common" - "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" "github.com/jfrog/jfrog-client-go/utils/errorutils" "github.com/urfave/cli" ) @@ -80,7 +79,8 @@ func convertCommand(cmd Command, namespaces ...string) (cli.Command, error) { if err != nil { return cli.Command{}, err } - return cli.Command{ + + cliCmd := cli.Command{ Name: cmd.Name, Flags: convertedFlags, Aliases: cmd.Aliases, @@ -93,9 +93,14 @@ func convertCommand(cmd Command, namespaces ...string) (cli.Command, error) { BashComplete: common.CreateBashCompletionFunc(), SkipFlagParsing: cmd.SkipFlagParsing, Hidden: cmd.Hidden, + } + + if cmd.Action != nil { // Passing any other interface than 'cli.ActionFunc' will fail the command. - Action: getActionFunc(cmd), - }, nil + cliCmd.Action = getActionFunc(cmd) + } + + return cliCmd, nil } func removeEmptyValues(slice []string) []string { @@ -112,8 +117,8 @@ func removeEmptyValues(slice []string) []string { func createCommandUsages(cmd Command, convertedStringFlags map[string]StringFlag, namespaces ...string) (usages []string, err error) { // Handle manual usages provided. if cmd.UsageOptions != nil { - for _, manualUsage := range cmd.UsageOptions.Usage { - usages = append(usages, fmt.Sprintf("%s %s", coreutils.GetCliExecutableName(), manualUsage)) + if cmd.UsageOptions.Usage != nil { + usages = append(usages, cmd.UsageOptions.Usage...) } if cmd.UsageOptions.ReplaceAutoGeneratedUsage { return