Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit a954237

Browse files
Merge pull request #106 from glours/wording_refactoring
Some minor wording changes in the command and usage message
2 parents 2bc8d8d + f4f61f9 commit a954237

4 files changed

Lines changed: 22 additions & 16 deletions

File tree

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,17 +247,17 @@ Just try to use the plugin, open a terminal and write the following command:
247247
$ docker scan
248248
Usage: docker scan [OPTIONS] IMAGE
249249

250-
A tool to scan your docker image
250+
A tool to scan your images
251251

252252
Options:
253-
--accept-license Accept to using a third party scanning provider
253+
--accept-license Accept using a third party scanning provider
254254
--dependency-tree Show dependency tree with scan results
255255
--exclude-base Exclude base image from vulnerability scanning (requires --file)
256-
-f, --file string Dockerfile associated with image
256+
-f, --file string Dockerfile associated with image, provides more detailed results
257257
--json Output results in JSON format
258258
--login Authenticate to the scan provider using an optional token (with --token), or web base token if empty
259-
--reject-license Reject to using a third party scanning provider
260-
--token string Authentication token for login to the scan provider
259+
--reject-license Reject using a third party scanning provider
260+
--token string Authentication token to login to the third party scanning provider
261261
--version Display version of the scan plugin
262262
```
263263

cmd/docker-scan/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func newScanCmd(ctx context.Context, dockerCli command.Cli) *cobra.Command {
7575
var flags options
7676
cmd := &cobra.Command{
7777
Short: "Docker Scan",
78-
Long: `A tool to scan your docker image`,
78+
Long: `A tool to scan your images`,
7979
Use: "scan [OPTIONS] IMAGE",
8080
Annotations: map[string]string{},
8181
RunE: func(cmd *cobra.Command, args []string) error {
@@ -89,14 +89,14 @@ func newScanCmd(ctx context.Context, dockerCli command.Cli) *cobra.Command {
8989
},
9090
}
9191
cmd.Flags().BoolVar(&flags.login, "login", false, "Authenticate to the scan provider using an optional token (with --token), or web base token if empty")
92-
cmd.Flags().StringVar(&flags.token, "token", "", "Authentication token for login to the scan provider")
92+
cmd.Flags().StringVar(&flags.token, "token", "", "Authentication token to login to the third party scanning provider")
9393
cmd.Flags().BoolVar(&flags.dependencyTree, "dependency-tree", false, "Show dependency tree with scan results")
9494
cmd.Flags().BoolVar(&flags.excludeBase, "exclude-base", false, "Exclude base image from vulnerability scanning (requires --file)")
95-
cmd.Flags().StringVarP(&flags.dockerFilePath, "file", "f", "", "Dockerfile associated with image")
95+
cmd.Flags().StringVarP(&flags.dockerFilePath, "file", "f", "", "Dockerfile associated with image, provides more detailed results")
9696
cmd.Flags().BoolVar(&flags.jsonFormat, "json", false, "Output results in JSON format")
9797
cmd.Flags().BoolVar(&flags.showVersion, "version", false, "Display version of the scan plugin")
98-
cmd.Flags().BoolVar(&flags.forceOptIn, "accept-license", false, "Accept to using a third party scanning provider")
99-
cmd.Flags().BoolVar(&flags.forceOptOut, "reject-license", false, "Reject to using a third party scanning provider")
98+
cmd.Flags().BoolVar(&flags.forceOptIn, "accept-license", false, "Accept using a third party scanning provider")
99+
cmd.Flags().BoolVar(&flags.forceOptOut, "reject-license", false, "Reject using a third party scanning provider")
100100

101101
return cmd
102102
}

e2e/testdata/plugin-usage.golden

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11

22
Usage: docker scan [OPTIONS] IMAGE
33

4-
A tool to scan your docker image
4+
A tool to scan your images
55

66
Options:
7-
--accept-license Accept to using a third party scanning provider
7+
--accept-license Accept using a third party scanning provider
88
--dependency-tree Show dependency tree with scan results
99
--exclude-base Exclude base image from vulnerability scanning
1010
(requires --file)
11-
-f, --file string Dockerfile associated with image
11+
-f, --file string Dockerfile associated with image, provides more
12+
detailed results
1213
--json Output results in JSON format
1314
--login Authenticate to the scan provider using an
1415
optional token (with --token), or web base
1516
token if empty
16-
--reject-license Reject to using a third party scanning provider
17-
--token string Authentication token for login to the scan provider
17+
--reject-license Reject using a third party scanning provider
18+
--token string Authentication token to login to the third
19+
party scanning provider
1820
--version Display version of the scan plugin

internal/provider/snyk.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,11 @@ func (s *snykProvider) Version() (string, error) {
167167
cmd.Stdout = buff
168168
cmd.Stderr = buffErr
169169
if err := cmd.Run(); err != nil {
170-
return "", fmt.Errorf("failed to get snyk version: %s, %s", checkCommandErr(err), buffErr.String())
170+
errMsg := fmt.Sprintf("failed to get snyk version: %s", checkCommandErr(err))
171+
if buffErr.String() != "" {
172+
errMsg = fmt.Sprintf(errMsg+",%s", buffErr.String())
173+
}
174+
return "", fmt.Errorf(errMsg)
171175
}
172176
return fmt.Sprintf("Snyk (%s)", strings.TrimSpace(buff.String())), nil
173177
}

0 commit comments

Comments
 (0)