/day-counter-cli

A command line tool for tracking time since an event after entering a start time.

Primary LanguagePythonMIT LicenseMIT

Day Counter

This is a command line (CLI) tool in Python which tracks time (days, hours, minutes) since an event. This counter has two command line arguments: --view and --reset. I first wrote this program as a script, but I wanted to learn how to make CLI tools as the next step. So this is my first experience with building CLI tools.

⚙️ Requirements

  • Python 3.x

💻 Tech Stack

  • Python

🌟 Features

  • Command line arguments with argparse - use the day counter with two simple commands:

    --view (check the current counter)

    --reset(reset the counter or set the counter for the first time)

  • File handling and data persistence - saves the time counter data in a JSON file

🚀 Getting Started

Follow these steps to download and run the program:

  1. Clone the repository or click the green Code button, then select Download ZIP to download the repository

  2. Extract the zip file to a folder on your computer

  3. Open Terminal (macOS/Linux) or Command Prompt/Anaconda Prompt (Windows)

  4. Navigate to the folder:

    cd path/to/project

  5. Run the program:

    python day_counter.py --reset

    python day_counter.py --view

📸 Demo

scr1

📖 What I Learned

  • Error handling with try/except
  • Building a CLI tool with argparse module from Python standard library

📄 License

This project is licensed under the MIT License.