Skip to content

Commit 57f0c2c

Browse files
committed
cmd: error out when command used with explicit message
1 parent 665a4df commit 57f0c2c

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

cmd/root.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"strings"
99
"text/template"
1010

11+
"github.com/docker/cli/cli"
1112
"github.com/docker/cli/cli/command"
1213
"github.com/docker/sbom-cli-plugin/internal"
1314
"github.com/docker/sbom-cli-plugin/internal/bus"
@@ -50,7 +51,15 @@ func cmd(dockerCli command.Cli) *cobra.Command {
5051
SilenceUsage: true,
5152
SilenceErrors: true,
5253
Version: version.FromBuild().Version,
53-
RunE: newRunner(dockerCli).run,
54+
RunE: func(cmd *cobra.Command, args []string) error {
55+
if len(args) == 0 {
56+
return cmd.Help()
57+
}
58+
return cli.StatusError{
59+
StatusCode: 1,
60+
Status: `error: docker sbom has been removed, please use "docker scout sbom" command instead`,
61+
}
62+
},
5463
}
5564

5665
c.SetVersionTemplate(fmt.Sprintf("%s {{.Version}}, build %s\n", internal.ApplicationName, version.FromBuild().GitCommit))

0 commit comments

Comments
 (0)