1.0.0 • Published 5 months ago

@iron-tools/cli v1.0.0

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

CLI

A unified command-line interface for all iron-tools packages.

Table of Contents

Overview

The cli package provides a unified command-line interface for all iron-tools packages. It serves as a central entry point for managing course schedules, allowing you to run calendar synchronization and holiday insertion tools through a single command.

Features

  • Unified interface for all iron-tools packages
  • Supports calendar synchronization and holiday management
  • Consistent command structure across all tools
  • Validates input arguments and provides helpful error messages
  • 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

Run the iron-tools command with the appropriate package name and options:

iron-tools @<package-name> [options]

Available Commands

  • @calendar - Synchronize and insert dates into course schedules
  • @holiday - Insert holidays into course schedules

Options

Common options across all commands:

  • -f, --file <filename>: Path to the input YAML file (default: index.yaml)
  • -h, --help: Display help information for a specific command

Command-specific options vary by package. Use iron-tools @<package-name> --help for detailed options.

Examples

Synchronize calendar dates:

$ 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

Insert a holiday:

$ iron-tools @holiday -f ./index.yaml -w 2 -d 5
✨ holiday process started ✨
• Validating arguments
  → validation for input file: "index.yaml", weekNum: 2, dayNum: 5
  ✓ 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 week blocks in course file
  → Located 11 week blocks in course structure
  ✓ Week identification complete
• Inserting holiday at Week 2, Day 5
  → Inserted holiday at position 9 (total days now: 56)
  ✓ Holiday designation complete
• Writing updated schedule to "index.yaml"
  → Updated schedule saved to index.yaml
  ✓ File writing complete

Display help for a specific command:

$ iron-tools @calendar --help
Usage: iron-tools @calendar [options]

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
  -h, --help            Display help for command

Error Handling

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

  • Invalid command or package name
  • Missing required arguments
  • Invalid file path or format
  • Package-specific validation errors

How It Works

  1. Parses the command-line arguments to identify the target package and options
  2. Validates the package name and required arguments
  3. Loads and executes the specified iron-tools package
  4. Passes through all package-specific options and arguments
  5. Provides unified error handling and logging across all packages

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.