Skip to content

Commit 77efcf8

Browse files
committed
fix dockerscan panic and a typo in usage
1 parent af607d1 commit 77efcf8

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

plugins/components/conversionlayer.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77

88
"github.com/jfrog/gofrog/datastructures"
99
"github.com/jfrog/jfrog-cli-core/v2/docs/common"
10-
"github.com/jfrog/jfrog-cli-core/v2/utils/coreutils"
1110
"github.com/jfrog/jfrog-client-go/utils/errorutils"
1211
"github.com/urfave/cli"
1312
)
@@ -80,7 +79,8 @@ func convertCommand(cmd Command, namespaces ...string) (cli.Command, error) {
8079
if err != nil {
8180
return cli.Command{}, err
8281
}
83-
return cli.Command{
82+
83+
cliCmd := cli.Command{
8484
Name: cmd.Name,
8585
Flags: convertedFlags,
8686
Aliases: cmd.Aliases,
@@ -93,9 +93,14 @@ func convertCommand(cmd Command, namespaces ...string) (cli.Command, error) {
9393
BashComplete: common.CreateBashCompletionFunc(),
9494
SkipFlagParsing: cmd.SkipFlagParsing,
9595
Hidden: cmd.Hidden,
96+
}
97+
98+
if cmd.Action != nil {
9699
// Passing any other interface than 'cli.ActionFunc' will fail the command.
97-
Action: getActionFunc(cmd),
98-
}, nil
100+
cliCmd.Action = getActionFunc(cmd)
101+
}
102+
103+
return cliCmd, nil
99104
}
100105

101106
func removeEmptyValues(slice []string) []string {
@@ -112,8 +117,8 @@ func removeEmptyValues(slice []string) []string {
112117
func createCommandUsages(cmd Command, convertedStringFlags map[string]StringFlag, namespaces ...string) (usages []string, err error) {
113118
// Handle manual usages provided.
114119
if cmd.UsageOptions != nil {
115-
for _, manualUsage := range cmd.UsageOptions.Usage {
116-
usages = append(usages, fmt.Sprintf("%s %s", coreutils.GetCliExecutableName(), manualUsage))
120+
if cmd.UsageOptions.Usage != nil {
121+
usages = append(usages, cmd.UsageOptions.Usage...)
117122
}
118123
if cmd.UsageOptions.ReplaceAutoGeneratedUsage {
119124
return

0 commit comments

Comments
 (0)