Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): show help when no argument is passed #628

Merged
merged 4 commits into from Sep 8, 2020

Conversation

masahiro331
Copy link
Collaborator

@masahiro331 masahiro331 commented Sep 7, 2020

Trivy version

$ ./trivy
VERSION:   dev

$ git rev-parse HEAD
2231e4068d5b6f7d0f2707d8669d6f906fc4ebaa

PR Description

  1. Trivy client command has bug. If run arguments empty, trivy client command put error.
$ trivy c
2020-09-07T23:53:14.510+0900    FATAL   failed to initialize options: no target is specified

fix that

$ trivy c 
NAME:
   trivy - A simple and comprehensive vulnerability scanner for containers

USAGE:
   trivy [global options] command [command options] target

VERSION:
   dev

COMMANDS:
   image, i          scan an image
   filesystem, fs    scan local filesystem
   repository, repo  scan remote repository
   client, c         client mode
   server, s         server mode
   help, h           Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --quiet, -q        suppress progress bar and log output (default: false) [$TRIVY_QUIET]
   --debug, -d        debug mode (default: false) [$TRIVY_DEBUG]
   --cache-dir value  cache directory (default: "/Users/masahiro331/Library/Caches/trivy") [$TRIVY_CACHE_DIR]
   --help, -h         show help (default: false)
   --version, -v      print the version (default: false)

  1. Changed so that no error is output when file system and repository commands execute help.

@codecov
Copy link

codecov bot commented Sep 7, 2020

Codecov Report

Merging #628 into master will decrease coverage by 0.21%.
The diff coverage is 57.14%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #628      +/-   ##
==========================================
- Coverage   54.84%   54.63%   -0.22%     
==========================================
  Files          48       48              
  Lines        2299     2297       -2     
==========================================
- Hits         1261     1255       -6     
- Misses        908      910       +2     
- Partials      130      132       +2     
Impacted Files Coverage Δ
internal/config/artifact.go 66.66% <40.00%> (-22.23%) ⬇️
internal/artifact/config/config.go 86.20% <100.00%> (-0.46%) ⬇️
internal/client/config/config.go 82.85% <100.00%> (-0.48%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2231e40...0c62090. Read the comment docs.

@masahiro331 masahiro331 changed the title Fix subcommands help [WIP]Fix subcommands help Sep 7, 2020
@masahiro331 masahiro331 changed the title [WIP]Fix subcommands help Fix subcommands help Sep 7, 2020
@knqyf263 knqyf263 changed the title Fix subcommands help fix(cli): show help when no argument is passed Sep 8, 2020
@knqyf263 knqyf263 merged commit 095b5ce into aquasecurity:master Sep 8, 2020
liamg pushed a commit that referenced this pull request Jun 7, 2022
* Fix subcommands help

* refactor: call ShowAppHelpAndExit

* refactor: remove an unused error

* test: remove exit cases

Co-authored-by: knqyf263 <knqyf263@gmail.com>
josedonizetti pushed a commit to josedonizetti/trivy that referenced this pull request Jun 24, 2022
* fix: support source/target tags for GCP firewall

Signed-off-by: Owen Rumney <owen.rumney@aquasec.com>

* Update pkg/terraform/attribute.go

Co-authored-by: Liam Galvin <liam.galvin@aquasec.com>

Co-authored-by: Liam Galvin <liam.galvin@aquasec.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants