1.0.0 • Published 5 months ago

@iron-tools/calendar v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

Calendar

A CLI tool for synchronizing and inserting dates into course schedules defined in index.yaml.

Table of Contents

Overview

The calendar package automates the process of adding synchronized dates to course schedules. It ensures that each day in the schedule is properly labeled with its corresponding date, making schedules easier to follow and manage.

Features

  • Inserts synchronized dates into day entries in index.yaml.
  • Supports resetting (removing) all inserted dates.
  • Validates input arguments and file structure.
  • Creates backups of the original file to prevent data loss.
  • Provides detailed logs for transparency and debugging.

Installation

Install the iron-tools CLI globally using npm:

npm install -g @iron-tools/cli
iron-tools --version

Usage

In the same directory where the index.yaml file is located, run the calendar tool using the iron-tools command:

iron-tools @calendar -f <index.yaml> -d <day> -m <month> -y <year> [--reset]

Options

  • -d, --day <number>: Day of the start date.
  • -m, --month <number>: Month of the start date.
  • -y, --year <number>: Year of the start date.
  • -f, --file <filename>: Path to the input YAML file (default: index.yaml).
  • --reset: Reset all inserted dates.

Examples

Insert synchronized dates starting from January 1, 2023:

$ iron-tools @calendar -f ./index.yaml -d 7 -m 4 -y 2025
✨ Calendar process started ✨
• Validating arguments
  → Validating input file: "index.yaml", day: 7, month: 4, year: 2025...
  ✓ arguments validation complete
• Generating backup file
→ Creating backup of "index.yaml" to "backup-index.yaml"
  ✓ Backup created successfully
• Reading and parsing input file
  → Successfully parsed 2578 lines from "index.yaml"
  ✓ File parsing complete
• Identifying day blocks in course file
  → Located 55 day blocks in course structure
  ✓ Day identification complete
• Inserting synchronized dates
  → Inserted dates starting from "04/07/2025" (total days: 55)
  ✓ Date insertion complete
• Writing updated schedule to "index.yaml"
  → Updated schedule saved to index.yaml
  ✓ File writing complete

Reset all inserted dates:

$ iron-tools @calendar -f ./index.yaml --reset
✨ Calendar process started ✨
• Validating arguments
  → validation for input file: "index.yaml"
  ✓ arguments validation complete
• Generating backup file
  → Creating backup of "index.yaml" to "backup-index.yaml"
  ✓ Backup created successfully
• Reading and parsing input file
  → Successfully parsed 2578 lines from "index.yaml"
  ✓ File parsing complete
• Identifying day blocks in course file
  → Located 55 day blocks in course structure
  ✓ Day identification complete
• Resetting synchronized dates
→ Removed all inserted dates (total days: 55)
  ✓ Date reset complete
• Writing updated schedule to "index.yaml"
  → Updated schedule saved to index.yaml
  ✓ File writing complete

Error Handling

The calendar tool provides detailed error messages for common issues, such as:

  • Invalid file path or format.
  • Incorrect date format.
  • Missing required arguments.

How It Works

  1. Parses the input index.yaml file to identify day blocks.
  2. Inserts synchronized dates into each day block based on the provided start date.
  3. Creates a backup of the original file to ensure data safety.
  4. Writes the updated schedule back to the file.

License

This project is licensed under the MIT License. See the LICENSE file for details.

⚠️ This is a private proprietary package. Not intended for public use or redistribution.

1.0.0

5 months ago