Rust | supernova [0]
Adding a Markdown file output using Rust in supernova
supernova is a commandline tool made by a friend of mine for grabbing information on starred Github repos and outputting them.
Issue:
Malformed markdown - looks nice in terminal but doesn’t translate into and actual markdown file nicely.
Solution:
Hunted down some Rust file output examples - had done basic readme adjustments but wanted to actually play with Rust so decided to extend the issue to allow a file generation.
- Include necessary imports to enable file manipulation
- Initialize the file through creation and indicating location of path
- Catch errors
- Loop to print each starred repository
- Force a 2 space + carriage return to force new lines on each repo printed
Side Issues:
Had a lot of good code review from the maintainer:
- No ability for the user to indicate what name of the file, where the file is generated or even just not to generate the file
- Rust-specific best practises not being used (which is interesting, due to most of the tutorials on Rust file generation does not use best practises or even depreciated commands)
- Getting used to Rust syntax and somehow scrounging up the time to go back and fix up the PR.
Benefit:
Having a nicely formatted, markdown file filled with starred repos can be useful for quick searching and better visualization than via terminal output.
As always, link to the pull request.