๐Ÿ—๏ธ Project: Command Framework

๐Ÿ“š Lesson 5: Object-Oriented Basics โฑ 30-35 min ๐Ÿ“Š Intermediate
๐ŸŽฏ Objective

Build a reusable CLI command framework using abstract classes, inheritance, and polymorphism. This is the foundation for professional command-line applications.

Requirements

  1. Create an abstract Command class with name, description, and abstract execute method
  2. Create a CommandRunner class that registers and executes commands
  3. Implement HelpCommand that displays available commands
  4. Implement EchoCommand that repeats user input
  5. Implement MathCommand that performs calculations
  6. Support command-line argument parsing
  7. Handle unknown commands gracefully

Expected Output

Terminal
$ dart run cli.dart help
Available commands:
  help      - Show help information
  echo      - Repeat the input text
  math      - Perform mathematical calculations
  greet     - Display a greeting

$ dart run cli.dart echo Hello World
Echo: Hello World

$ dart run cli.dart math add 5 10
5 + 10 = 15

$ dart run cli.dart math multiply 6 7
6 ร— 7 = 42