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

feat(color): add --no-color flag #5368

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

MrSecure
Copy link
Contributor

Context

Fix #5294

Description

  • Import colorama's init
  • Add --no-color / -Q command line option (default False)
  • Use no_color option to control colorama init.

Checklist

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

- add --no-color / -Q CLI argument
- initialize colorama based on that arg
so that `pytest -m arg_parser` can be run to test only the updated
argument handling
@MrSecure MrSecure requested review from a team as code owners October 10, 2024 18:12
Copy link

codecov bot commented Oct 10, 2024

Codecov Report

Attention: Patch coverage is 20.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 89.33%. Comparing base (4181ca5) to head (41dc28a).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
prowler/__main__.py 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5368      +/-   ##
==========================================
- Coverage   89.38%   89.33%   -0.05%     
==========================================
  Files        1018     1019       +1     
  Lines       31278    31348      +70     
==========================================
+ Hits        27959    28006      +47     
- Misses       3319     3342      +23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sergargar sergargar changed the title Feature/5294 no color feat(color): add --no-color flag Oct 10, 2024
@sergargar
Copy link
Member

Hi @MrSecure, thanks a lot for your contribution! We will review this asap.

@MrSecure
Copy link
Contributor Author

Should the --only-logs flag set --no-color in addition to --no-banner ?
Or does that complicate things since --only-logs is slated for removal in v5?

@jfagoagas
Copy link
Member

Should the --only-logs flag set --no-color in addition to --no-banner ? Or does that complicate things since --only-logs is slated for removal in v5?

The --only-logs flag removes all the pure CLI output so there is no need to set also --no-color and it is going to be deprecated in v5 since it is no longer needed because Prowler is usable as an SDK.

Regarding the --no-banner, I think they should work independently.

Copy link
Member

@pedrooot pedrooot left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution! Please review my comments 🙏🏼

Comment on lines +118 to +119
else:
colorama_init(strip=False)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
else:
colorama_init(strip=False)

Is this needed?

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.

Add flag to disable color output
4 participants