- Change `todo done <N>` to variadic `todo done <N>...` for stable indices across sequential calls - Process multiple numbers highest-index-first so lower indices remain valid as tasks are removed - Validate all numbers upfront before mutating any files - After marking done, print the full task block (same format as list) so the user gets visual confirmation of what was completed - Extract `mark_task_done` as a testable helper; add unit tests
30 lines
1.2 KiB
Rust
30 lines
1.2 KiB
Rust
use clap::Parser;
|
|
use streamd::cli::{Cli, Commands, TodoAction};
|
|
|
|
fn main() -> miette::Result<()> {
|
|
let cli = Cli::parse();
|
|
|
|
match cli.command {
|
|
Some(Commands::New) => streamd::cli::commands::new::run()?,
|
|
Some(Commands::Todo {
|
|
show_future,
|
|
action,
|
|
}) => match action {
|
|
None => streamd::cli::commands::todo::run_list(show_future)?,
|
|
Some(TodoAction::Edit { number }) => streamd::cli::commands::todo::run_edit(number)?,
|
|
Some(TodoAction::Done { numbers }) => streamd::cli::commands::todo::run_done(&numbers)?,
|
|
},
|
|
Some(Commands::Edit { number }) => streamd::cli::commands::edit::run(number)?,
|
|
Some(Commands::Timesheet { decimal, debug }) => {
|
|
streamd::cli::commands::timesheet::run(decimal, debug)?
|
|
}
|
|
Some(Commands::Daily { date }) => streamd::cli::commands::daily::run(date)?,
|
|
Some(Commands::Completions { shell }) => {
|
|
streamd::cli::commands::completions::run(shell);
|
|
}
|
|
Some(Commands::Lsp) => streamd::cli::commands::lsp::run()?,
|
|
None => streamd::cli::commands::daily::run(None)?,
|
|
}
|
|
|
|
Ok(())
|
|
}
|