Building My First Python CLI Tool: A Simple Day Counter to Track Time

Hello DEV community! 👋

I recently started working on personal projects, writing small scripts and sharing them on GitHub. Before that, I mostly followed tutorials and read programming books, but building my own projects helped me learn faster and gras…


This content originally appeared on DEV Community and was authored by Adam Malsagov

Hello DEV community! 👋

I recently started working on personal projects, writing small scripts and sharing them on GitHub. Before that, I mostly followed tutorials and read programming books, but building my own projects helped me learn faster and grasp concepts more deeply. As the next step in my learning journey, I developed my first command-line interface (CLI) tool, Day Counter, which I’m excited to share.

What is Day Counter?

Day Counter is a lightweight CLI tool in Python that tracks time in days, hours, and minutes since a specific event. The program stores time in a JSON file and displays the elapsed time. I started with a simple script and expanded it into a CLI tool to deepen my understanding of command-line applications.

Features

  • Command-line arguments:
    • --view: Check the current time elapsed since the event.
    • --reset: Reset or initialize the counter.
  • Persistent data storage:
    • Saves the timestamp data to a JSON file, so your counter keeps track even after closing the program.

How It Works

Using Day Counter is straightforward. To start tracking time since an event, run:

python day_counter.py --reset

to start or reset the counter. You can check the counter anytime with:

python day_counter.py --view

to see how much time has passed.

Day Counter CLI showing --reset and --view commands in terminal Example of running the Day Counter CLI tool

Conclusion

Day Counter is a simple CLI tool that introduced me to command-line applications. It provided a solid foundation for creating more advanced CLI tools in the future, with more command line arguments and the use of third-party libraries.

GitHub Repository

If you want to try it out or check out the code, here’s the repository: https://github.com/adam-malsagov/day-counter-cli

Thanks for reading!


This content originally appeared on DEV Community and was authored by Adam Malsagov


Print Share Comment Cite Upload Translate Updates
APA

Adam Malsagov | Sciencx (2025-08-30T09:29:20+00:00) Building My First Python CLI Tool: A Simple Day Counter to Track Time. Retrieved from https://www.scien.cx/2025/08/30/building-my-first-python-cli-tool-a-simple-day-counter-to-track-time-2/

MLA
" » Building My First Python CLI Tool: A Simple Day Counter to Track Time." Adam Malsagov | Sciencx - Saturday August 30, 2025, https://www.scien.cx/2025/08/30/building-my-first-python-cli-tool-a-simple-day-counter-to-track-time-2/
HARVARD
Adam Malsagov | Sciencx Saturday August 30, 2025 » Building My First Python CLI Tool: A Simple Day Counter to Track Time., viewed ,<https://www.scien.cx/2025/08/30/building-my-first-python-cli-tool-a-simple-day-counter-to-track-time-2/>
VANCOUVER
Adam Malsagov | Sciencx - » Building My First Python CLI Tool: A Simple Day Counter to Track Time. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/08/30/building-my-first-python-cli-tool-a-simple-day-counter-to-track-time-2/
CHICAGO
" » Building My First Python CLI Tool: A Simple Day Counter to Track Time." Adam Malsagov | Sciencx - Accessed . https://www.scien.cx/2025/08/30/building-my-first-python-cli-tool-a-simple-day-counter-to-track-time-2/
IEEE
" » Building My First Python CLI Tool: A Simple Day Counter to Track Time." Adam Malsagov | Sciencx [Online]. Available: https://www.scien.cx/2025/08/30/building-my-first-python-cli-tool-a-simple-day-counter-to-track-time-2/. [Accessed: ]
rf:citation
» Building My First Python CLI Tool: A Simple Day Counter to Track Time | Adam Malsagov | Sciencx | https://www.scien.cx/2025/08/30/building-my-first-python-cli-tool-a-simple-day-counter-to-track-time-2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.