use clap::{Parser, Subcommand}; use serde::{Deserialize, Serialize}; #[derive(Parser)] #[command(name = "todo")] #[command(about = "A simple todo list manager")] struct Cli { #[command(subcommand)] command: Commands, } #[derive(Subcommand)] enum Commands { Add { task: String }, List, Complete { id: usize }, Remove { id: usize }, } #[derive(Serialize, Deserialize, Debug)] struct Task { id: usize, description: String, completed: bool, } #[derive(Serialize, Deserialize, Debug)] struct TodoList { tasks: Vec, next_id: usize, } fn main() { let cli = Cli::parse(); match cli.command { Commands::Add { task } => { println!("Adding task: {}", task); } Commands::List => { println!("Listing tasks"); } Commands::Complete { id } => { println!("Completing task with id: {}", id); } Commands::Remove { id } => { println!("Removing task with id: {}", id); } } }