DEV Community

OleksandraKordonets
OleksandraKordonets

Posted on • Edited on

Adding TOML Config Support to a CLI Tool

For the past five weeks in my OSD class we’ve been building Release 0.1, a small command-line tool that inspects local Git repositories and produces a single, well-structured text file of the repo content optimized for sharing with Large Language Models (LLMs). The tool is lightweight but tries to save time for anyone who needs to package up a project for analysis. Today I contributed to a classmate’s repo by adding a simple but useful feature: the ability to store default options in a TOML “dotfile” so you don’t have to type the same CLI flags every time.

The code change itself was small, I added a loader in main.py that looks for a dotfile .share-my-repo-config.toml, tries Python 3.11’s tomllib and falls back to tomli on older Pythons, and applies values from the file as defaults while still letting any command-line option override them. That “flags always win” precedence was the most important bit as the program only applies a config setting when the corresponding CLI argument is still at its default.

Issue I raised: issue-8
PR I made: PR

While working on the code I ran into a few problems, partly because I’m still getting comfortable with Python and hadn’t used it much before. It took me a while to understand the project flow, but once I did the code became easier to follow than the C++ I’ve used in my rep. Python made the implementation shorter and more readable, which was a big help. Implementing the TOML support itself was a great learning moment as TOML was new to me, so I had to do some research to figure out the best parser to use and how to integrate it cleanly.

Also, a part of the collaboration plan was that another student would also contribute changes back to my repository, but as of writing this that hasn’t happened yet. Still, I really like the TOML-config feature I implemented, it’s small but genuinely useful, and I’ve been thinking about bringing a version of it into my own C++ project. In C++, that would mean adding a TOML parsing library (for example, toml++) and extending the CLI initialization so that default options can come from a .repository-context-packager.toml file. Just like in Python, command-line arguments would always take precedence over config values. For now, I’m happy to take the next step and integrate the feature into my own repo.

Another thing I wanted to mention is how much better I've gotten at Git in the last few weeks. I used to feel uncertain a lot, but this course and working on features made me feel better. Every step began to make sense: when to start a feature branch, why small, focused commits are useful, and how pushing to a fork lets you safely share work without affecting the original repo. And beyond the commands, I feel like the biggest change is my confidence. What used to be confusing now feels like a routine: create a branch for each feature, make incremental commits, push to a fork, and open a Draft PR for early feedback. I’m genuinely excited to keep contributing and become a productive member of an open-source community.

Top comments (0)