DEV Community

DenisC
DenisC

Posted on

Adding New Feature Inspired by Other Projects

As mentioned in my last post about the feature I found in Repomix, I am going to add the --remove-empty-lines option to my project while making reference to Repomix. The feature is to remove blank lines from all files when writing file contents, which could be useful to reduce the file size and no. of lines in the output file, such that it does not exceed the size/line limit for AI analysis.

The first step to add this new feature is to do a prototype. As both the structure and programming language of my project is different from those of Repomix, I had to adjust the code when prototyping. Firstly, I added the new flag to the argument parser, which is a separate module in my codes. I then added a remove_empty_lines helper function to process the empty lines removal on the file content, which used the same logic as the removeEmptyLines in fileManipulate.ts of Repomix. I've also altered the write_file_content function to receive the empty_lines_removed flag as a parameter, for further processing within the function.

The changes I've made for prototyping can be tracked in this commit. What's left now is to change the logic within write_file_content function to cater for the case when the empty_lines_removed flag is true, and to update README.md after the new feature has been implemented and tested. To document the progress of implementing this feature, I have filed an issue that described the overall steps to implement the feature. After doing the basic prototyping, I've filed a sub-issue that requires changes in write_file_content function, and another sub-issue about the changes in README.md, such that other users can see the progress or help contribute to the issues.

Top comments (0)