Step 3: Page 28
This commit is contained in:
14
src/main.rs
14
src/main.rs
@@ -1,4 +1,5 @@
|
||||
use clap::{Parser, Subcommand};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(name = "todo")]
|
||||
@@ -16,6 +17,19 @@ enum Commands {
|
||||
Remove { id: usize },
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
struct Task {
|
||||
id: usize,
|
||||
description: String,
|
||||
completed: bool,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
struct TodoList {
|
||||
tasks: Vec<Task>,
|
||||
next_id: usize,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let cli = Cli::parse();
|
||||
match cli.command {
|
||||
|
||||
Reference in New Issue
Block a user