Skip to content

Remove global flags from filesystem command#772

Merged
knqyf263 merged 2 commits intoaquasecurity:mainfrom
xperimental:fix-fs-flags
Jan 5, 2021
Merged

Remove global flags from filesystem command#772
knqyf263 merged 2 commits intoaquasecurity:mainfrom
xperimental:fix-fs-flags

Conversation

@xperimental
Copy link
Contributor

@xperimental xperimental commented Dec 10, 2020

If the global flags are added to the subcommand as well as being used globally, their value will be overwritten when the arguments for the subcommand are parsed. This leads to the value passed to the flag at the global position being lost:

trivy --quiet fs --format json /

The --quiet here is without effect, which means that the log messages are still written to the output.

This issue can also be fixed in the "other direction" by removing the flags from the global options, depending on which style of options is preferred, just one style should be used across the whole application. I can update this PR depending on the decision.

@CLAassistant
Copy link

CLAassistant commented Dec 10, 2020

CLA assistant check
All committers have signed the CLA.

@xperimental xperimental force-pushed the fix-fs-flags branch 2 times, most recently from dc4dcfa to ad37fe4 Compare December 10, 2020 14:17
@xperimental xperimental marked this pull request as ready for review December 10, 2020 14:28
@xperimental
Copy link
Contributor Author

Is there any way to trigger the missing "circleci" check?

@knqyf263 knqyf263 changed the base branch from master to main December 17, 2020 13:36
@knqyf263
Copy link
Collaborator

knqyf263 commented Jan 3, 2021

Is there any way to trigger the missing "circleci" check?

Could you merge the main branch into this branch? I believe it will fix the issue.

Also, would you fix README as well?

If the global flags are added to the subcommand as well as being used
globally, their value will be overwritten when the arguments for the
subcommand are parsed. This leads to the value passed to the flag at the
global position being lost.
@xperimental
Copy link
Contributor Author

Could you merge the main branch into this branch? I believe it will fix the issue.

Rebased the branch on top current main.

Also, would you fix README as well?

Updated using the output of the command with --help. This changes more than was changed using this PR. I can roll back the other changes if you like.

@codecov
Copy link

codecov bot commented Jan 4, 2021

Codecov Report

Merging #772 (dbd10b1) into main (a00d719) will decrease coverage by 0.14%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #772      +/-   ##
==========================================
- Coverage   68.50%   68.36%   -0.15%     
==========================================
  Files          57       57              
  Lines        2210     2200      -10     
==========================================
- Hits         1514     1504      -10     
  Misses        564      564              
  Partials      132      132              
Impacted Files Coverage Δ
internal/app.go 98.38% <ø> (-0.10%) ⬇️
pkg/detector/ospkg/redhat/redhat.go 93.54% <100.00%> (+0.21%) ⬆️

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 e517bcc...dbd10b1. Read the comment docs.

@simar7 simar7 self-requested a review January 4, 2021 21:30
Copy link
Member

@simar7 simar7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@knqyf263 knqyf263 merged commit e2c483f into aquasecurity:main Jan 5, 2021
@knqyf263
Copy link
Collaborator

knqyf263 commented Jan 5, 2021

Thanks a lot!

@xperimental
Copy link
Contributor Author

You're welcome!

@xperimental xperimental deleted the fix-fs-flags branch January 6, 2021 12:44
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.

4 participants