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

cscli config show: pretty print struct output #2633

Merged
merged 1 commit into from Dec 5, 2023
Merged

Conversation

mmetc
Copy link
Contributor

@mmetc mmetc commented Dec 1, 2023

This PR allows a user to discover field names in the run-time configuration without searching the source code.

The only issue I see is that some custom types like logrus.Level are not marshaled, i.e. will print "4" instead of "info" like the version with "%v". But it handles pointers and even recursive structures, so it can be a more readable (if less detailed) alternative to spew.

An alternative to litter would be kylelemons/godebug, which is less verbose (does not print struct names which are useless in this case) but has the same issue with LogLevel.

Copy link

github-actions bot commented Dec 1, 2023

@mmetc: There are no 'kind' label on this PR. You need a 'kind' label to generate the release automatically.

  • /kind feature
  • /kind enhancement
  • /kind fix
  • /kind chore
  • /kind dependencies
Details

I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

Copy link

github-actions bot commented Dec 1, 2023

@mmetc: There are no area labels on this PR. You can add as many areas as you see fit.

  • /area agent
  • /area local-api
  • /area cscli
  • /area security
  • /area configuration
Details

I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

@mmetc mmetc added the kind/enhancement New feature or request label Dec 1, 2023
@mmetc mmetc added this to the 1.5.6 milestone Dec 1, 2023
Copy link

codecov bot commented Dec 1, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7e5ab34) 58.22% compared to head (3552aa4) 58.24%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2633      +/-   ##
==========================================
+ Coverage   58.22%   58.24%   +0.01%     
==========================================
  Files         201      201              
  Lines       27048    27048              
==========================================
+ Hits        15750    15754       +4     
+ Misses       9753     9749       -4     
  Partials     1545     1545              
Flag Coverage Δ
bats 38.30% <100.00%> (-0.10%) ⬇️
unit-linux 55.24% <ø> (+0.01%) ⬆️
unit-windows 51.56% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@mmetc mmetc changed the title cscli config show: pretty print with package "litter" cscli config show: pretty print struct output Dec 1, 2023
@mmetc mmetc requested a review from sabban December 1, 2023 16:21
@sabban sabban self-assigned this Dec 4, 2023
Copy link
Contributor

@sabban sabban left a comment

Choose a reason for hiding this comment

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

lgtm

@mmetc mmetc merged commit 0f3ae64 into master Dec 5, 2023
15 checks passed
@mmetc mmetc deleted the config-show-litter branch December 5, 2023 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request needs/area
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants