Misleading correction for "most similar command" helper
Describe the bug
When a user attempts to use the command jf docker-scan, which is not an actual jf command, the most similar command search incorrectly recommends the command jf dockerscan. There isn't a dockerscan command, but there is a docker san command (a space inbetween docker and scan). This is misleading and will produce a panic in the JF CLI
This is reproducible on JF CLI v2.59.1
jf --version
jf version 2.59.1
Current behavior
Current behavior looks like this:
jf docker-scan tomjfrog.jfrog.io/webgoat-docker-dev-local/webgoat:3
'jf docker-scan' is not a jf command. See --help
The most similar command is:
jf dockerscan
Which returns this error output:
jf dockerscan tomjfrog.jfrog.io/webgoat-docker-dev-local/webgoat:3
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x192ee8f]
goroutine 1 [running]:
github.com/jfrog/jfrog-cli-core/v2/plugins/components.getActionFunc.func1(0xc0000bc000?)
/root/go/pkg/mod/github.com/jfrog/jfrog-cli-core/[email protected]/plugins/components/conversionlayer.go:373 +0x4f
github.com/urfave/cli.HandleAction({0x1bdc0a0?, 0xc00045ec30?}, 0xa?)
/root/go/pkg/mod/github.com/urfave/[email protected]/app.go:522 +0xb0
github.com/urfave/cli.Command.Run({{0x1d3a232, 0xa}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x1dbcffd, 0x39}, {0xc0004aa9c0, ...}, ...}, ...)
/root/go/pkg/mod/github.com/urfave/[email protected]/command.go:175 +0x67b
github.com/urfave/cli.(*App).Run(0xc0001f0700, {0xc00018e180, 0x3, 0x3})
/root/go/pkg/mod/github.com/urfave/[email protected]/app.go:277 +0xb87
main.execMain()
/var/jenkins_home/workspace/eco-system/release/jfrog-cli-release/temp/jfrog-cli/main.go:148 +0x509
main.main()
/var/jenkins_home/workspace/eco-system/release/jfrog-cli-release/temp/jfrog-cli/main.go:84 +0x25
Reproduction steps
Execute jf docker-scan on the JFrog CLI
Expected behavior
The most similar command search should return the valid command jf docker scan
JFrog CLI version
2.59.1
Operating system type and version
OS: macOS 14.5 23F79 x86_64
JFrog Artifactory version
JF Cloud
JFrog Xray version
latest SaaS Release
This issue has been marked as stale due to 6 months of inactivity. As part of our effort to address every issue properly, please feel free to remove the stale label or keep this issue active by leaving a comment. Otherwise, it will be closed in 7 days
This issue is still relevant. The "stale" tag should be removed.
This issue has been marked as stale due to 6 months of inactivity. As part of our effort to address every issue properly, please feel free to remove the stale label or keep this issue active by leaving a comment. Otherwise, it will be closed in 7 days
This issue was closed due to 7 days of inactivity after being marked as stale. Feel free to reopen it if it remains relevant.