README Generation Project Post 1
Description of Project
This project is actually a smaller portion of what was originally a larger project I started in Spring of 2021. That original project was to allow me to have a terminal program that would allow me to manage to do lists that would be tied to the repositories I have on GitHub. Unfortunately I ran into feature creep. Preventing myself from getting any one feature that I wanted to work well. So that original project was abandoned. But only partially. Because I had written quite a bit for the features I wanted in that piece of software and because I still needed something to help manage my project. I decided to break the original project into smaller more manageable parts. And taking a page from the original Unix these parts will, if my plan comes together, will each be a separate program that can then be used along side the other parts with pipes and redirects to get the result I want. With this part being the first part that I decided to tackle sense it was the closest to completion.
The general idea of this project is to generate a file in markdown format that lists the repositories that I have on GitHub along side other information. Such as the repositories description and a link to the repository itself. Other features I’ve had in mind is to allow the list to actually be somewhat organized into “folders” of sorts. One example being the fact that I have 12 repositories from one of my earlier classes that are all somewhat related to each other. All of those repositories would have their own “sub-list” allowing me to find what I’m looking for easier. Another feature is to allow it to actually just inject the generated markdown within a section found within the target file. Like how Jekyll uses a template and injects the content into that template at a set spot. This would then allow me to use the same file for notes on the projects in question.
Current progress
As of today I have the injection portion of the project working and basic generation of the lists. With the list currently looking as follows.
<!--START-->
- [repo-name](repo-link)
- Repo description if it exists.
<!--END-->
With the <!--START-->
and <!--END-->
denoting the section to be replaced. At the moment this functionality is achieved using a temporary file. With the original contents of the file that the program is writing to being written to that file until the program comes across <!--START-->
. Once that happens it then injects the list into the temporary file and then writes whatever is found in the original file after <!--END-->
to the temporary file. From there the file pointer to the original file is closed then reopened in write mode. With the contents of the temporary file then being written to it. If the target file doesn’t contain <!--START-->
or <!--END-->
in the correct order it will simply append the markdown to be injected at the ended of the file. And if the target file doesn’t exist then the target file is then created with only the text to be injected.
Overall it works. But if I am completely honest with myself though I could likely get the same results if I was to do with with an array or even a linked list instead of effectively writing the contents of the file twice. But at the moment it works.
Future Plans
That being said the next part of the project is to organize the list itself. Though this will likely be after I fix a few annoyances. Like the fact that at the moment there is no real way of seeing the progress. As well as the fact that if the program is run on a slow network or on a GitHub account with a large number of repositories it can take a while because of the calls to get the information from using the API. This could easily be solved by running requests in parallel. But I still need to set that up.
I also need to add documentation in the program as well. Currently it is run using the command line like readme-gen <fileName.md>
which works. But I could add more functionality with some other command line arguments. Which would help in with the goal of making it possible to use this program with other. It’s also possible for fileName.md to contain spaces if quotation marks are used. With them being replaced with -
when actually accessing the target file to avoid possible issues with spaces and using the same file as a argument for other programs. This is not noted anywhere really. Giving even more reason for me to add documentation to the program. It would also give me practice with setting up Unix like flags.
Either way more posts on this project are likely to come as this is one way for me to document progress and what I have already working. If anything it gives me a reason to set up a proper projects/project template for Jekyll.