diff --git a/src/cli.rs b/src/cli.rs index 990f337..9de4de6 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -31,12 +31,13 @@ pub enum Commands { #[clap(visible_alias("m"))] Mark, - /// -> list all todo items in inbox + /// -> list all uncompeleted tasks in box #[clap(visible_aliases(["l", "ls"]))] - List { - #[arg(short, long)] - all: bool, - }, + List, + + /// -> list all(including compeleted) tasks + #[clap(visible_aliases(["la"]))] + Listall, /// -> list all todo box in working dir #[clap(visible_aliases(["lb"]))] diff --git a/src/main.rs b/src/main.rs index 1d4bf08..8f524a7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,7 +22,16 @@ fn main() { let inbox_path = get_inbox_file(args.dir, inbox); match args.command { - Some(Commands::Mark) | None => { + Some(Commands::List) | None => { + let mut todo = TaskBox::new(inbox_path); + todo.list(false); + } + Some(Commands::Listall) => { + let mut todo = TaskBox::new(inbox_path); + todo.list(true); + } + + Some(Commands::Mark) => { let mut todo = TaskBox::new(inbox_path); let (tasks,_) = todo._get_all(); if tasks.is_empty() { @@ -51,11 +60,6 @@ fn main() { execute!(io::stdout(), DefaultUserShape).expect("failed to set cursor"); } - Some(Commands::List { all }) => { - let mut todo = TaskBox::new(inbox_path); - todo.list(all); - } - Some(Commands::Add { what, date }) => { let mut todo = TaskBox::new(inbox_path);