Add snapshot flag for scripting purposes #358
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey there! I've been using nvtop and I love the functionality. I wanted to add an applet to Linux Mint, so I added a flag to output the stats as a static snapshot for that purpose
Purpose
Adds
-s
flag to cli to aid in scripting the output of nvtopDetails
When I first started trying to use nvtop for scripting out an applet (for Linux Mint Cinnamon desktop environment), ncurses wasn't playing nice with the runtime for the applets. I couldn't find any suitable alternatives that gave me the information I was looking for, so I decided to modify nvtop for my personal use case and thought others may be able to get some benefit from it as well.
This doesn't modify any core functionality of the application, and simply bypasses the ncurses initialization in order to print a static snapshot to STDOUT.
Screenshots
The command + output
The resulting "applet" that I created using the output
Disclaimers
I am not a C developer. I've never actually written in C before, so this was a great learning experience for me.
Thanks for taking a look!