-
Notifications
You must be signed in to change notification settings - Fork 19
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
lscpu
: Support extracting and outputting nested fields
#218
Conversation
fa54f64
to
9e1b825
Compare
lscpu
: Add support for nested fields in outputlscpu
: Support extracting and outputting nested fields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest looks good. Some tests would be nice ;-)
2e924fd
to
95d57eb
Compare
Thanks for the review. Moved the code around a bit as you suggested, and added a basic test for non-JSON output. One thing to note is that with these changes, I've gone ahead and added flags to the tests so they only get executed on Linux builds. Let me know if you have better ideas for a long-term approach 🙂 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #218 +/- ##
===========================
===========================
☔ View full report in Codecov by Sentry. |
Thanks!
The long-term approach is probably to use a crate like |
lscpu
should be capable of outputting nested information. When using human-readable output this is achieved simply using indentation, where as in JSON mode nested fields go under thechildren
property.Core changes:
CpuInfo
to be a recursive structure, allowing for nesting of entries through thechildren
property./proc/cpuinfo
, using a dynamically constructed Regex.-J
shorthand counterpart to the--json
option.Output: