From 9345a98ed1125d022e057d2c4066df0e17662cf1 Mon Sep 17 00:00:00 2001 From: Florian Bufler <94462700+fbufler@users.noreply.github.com> Date: Mon, 28 Aug 2023 10:46:39 +0200 Subject: [PATCH] docs(repo): update trivy repo usage and example (#5049) --- docs/docs/references/configuration/cli/trivy.md | 2 +- .../docs/references/configuration/cli/trivy_repository.md | 6 ++++-- docs/docs/target/repository.md | 6 +++--- docs/tutorials/shell/shell-completion.md | 2 +- pkg/commands/app.go | 8 +++++--- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/docs/docs/references/configuration/cli/trivy.md b/docs/docs/references/configuration/cli/trivy.md index 57a12c4d8e8e..f11635a25992 100644 --- a/docs/docs/references/configuration/cli/trivy.md +++ b/docs/docs/references/configuration/cli/trivy.md @@ -51,7 +51,7 @@ trivy [global flags] command [flags] target * [trivy kubernetes](trivy_kubernetes.md) - [EXPERIMENTAL] Scan kubernetes cluster * [trivy module](trivy_module.md) - Manage modules * [trivy plugin](trivy_plugin.md) - Manage plugins -* [trivy repository](trivy_repository.md) - Scan a remote repository +* [trivy repository](trivy_repository.md) - Scan a repository * [trivy rootfs](trivy_rootfs.md) - Scan rootfs * [trivy sbom](trivy_sbom.md) - Scan SBOM for vulnerabilities * [trivy server](trivy_server.md) - Server mode diff --git a/docs/docs/references/configuration/cli/trivy_repository.md b/docs/docs/references/configuration/cli/trivy_repository.md index 8cb611bd82e6..6cf418c5780e 100644 --- a/docs/docs/references/configuration/cli/trivy_repository.md +++ b/docs/docs/references/configuration/cli/trivy_repository.md @@ -1,9 +1,9 @@ ## trivy repository -Scan a remote repository +Scan a repository ``` -trivy repository [flags] REPO_URL +trivy repository [flags] (REPO_PATH | REPO_URL) ``` ### Examples @@ -11,6 +11,8 @@ trivy repository [flags] REPO_URL ``` # Scan your remote git repository $ trivy repo https://github.com/knqyf263/trivy-ci-test + # Scan your local git repository + $ trivy repo /path/to/your/repository ``` ### Options diff --git a/docs/docs/target/repository.md b/docs/docs/target/repository.md index 16bb29f43673..497bffc9e0db 100644 --- a/docs/docs/target/repository.md +++ b/docs/docs/target/repository.md @@ -86,7 +86,7 @@ It is disabled by default and can be enabled with `--scanners config`. See [here](../scanner/misconfiguration/index.md) for the detail. ```shell -$ trivy repo --scanners config [YOUR_REPO_URL] +$ trivy repo --scanners config (REPO_PATH | REPO_URL) ``` ### Secrets @@ -94,7 +94,7 @@ It is enabled by default. See [here](../scanner/secret.md) for the detail. ```shell -$ trivy repo [YOUR_REPO_URL] +$ trivy repo (REPO_PATH | REPO_URL) ``` ### Licenses @@ -102,7 +102,7 @@ It is disabled by default. See [here](../scanner/license.md) for the detail. ```shell -$ trivy repo --scanners license [YOUR_REPO_URL] +$ trivy repo --scanners license (REPO_PATH | REPO_URL) ``` ## SBOM generation diff --git a/docs/tutorials/shell/shell-completion.md b/docs/tutorials/shell/shell-completion.md index d969bd0869b2..1f9f3ecb154d 100644 --- a/docs/tutorials/shell/shell-completion.md +++ b/docs/tutorials/shell/shell-completion.md @@ -58,7 +58,7 @@ image -- Scan a container image kubernetes -- scan kubernetes cluster module -- Manage modules plugin -- Manage plugins -repository -- Scan a remote repository +repository -- Scan a repository rootfs -- Scan rootfs sbom -- Scan SBOM for vulnerabilities server -- Server mode diff --git a/pkg/commands/app.go b/pkg/commands/app.go index 78d1e6cd7423..0d2ed8c9727f 100644 --- a/pkg/commands/app.go +++ b/pkg/commands/app.go @@ -443,12 +443,14 @@ func NewRepositoryCommand(globalFlags *flag.GlobalFlagGroup) *cobra.Command { repoFlags.ReportFlagGroup.ExitOnEOL = nil // disable '--exit-on-eol' cmd := &cobra.Command{ - Use: "repository [flags] REPO_URL", + Use: "repository [flags] (REPO_PATH | REPO_URL)", Aliases: []string{"repo"}, GroupID: groupScanning, - Short: "Scan a remote repository", + Short: "Scan a repository", Example: ` # Scan your remote git repository - $ trivy repo https://github.com/knqyf263/trivy-ci-test`, + $ trivy repo https://github.com/knqyf263/trivy-ci-test + # Scan your local git repository + $ trivy repo /path/to/your/repository`, PreRunE: func(cmd *cobra.Command, args []string) error { if err := repoFlags.Bind(cmd); err != nil { return xerrors.Errorf("flag bind error: %w", err)