diff --git a/src/cli/cmds.rs b/src/cli/cmds.rs index 176252e..84d54a5 100644 --- a/src/cli/cmds.rs +++ b/src/cli/cmds.rs @@ -14,16 +14,6 @@ fn parse_tags(tags: Option) -> Option> { pub fn show(tasks: &mut Tasks, id: Option) -> Result<(), TasksError> { // If no id is given, print out all tasks if let Some(..) = id { - if tasks.is_empty() { - // Output when no tasks are available - output::info(String::from("no tasks found")) - } else { - // Generate the table of all tasks - let table = tables::tasks_table(tasks); - // Print the table - println!("{}", table); - }; - } else { // Get the task the user wants to see let id = id.unwrap(); let task = tasks.get_task(id)?; @@ -32,6 +22,14 @@ pub fn show(tasks: &mut Tasks, id: Option) -> Result<(), TasksError> { let table = tables::task_table(task, id); // Print the table println!("{}", table); + } else if tasks.is_empty() { + // Output when no tasks are available + output::info(String::from("no tasks found")) + } else { + // Generate the table of all tasks + let table = tables::tasks_table(tasks); + // Print the table + println!("{}", table); }; // Success diff --git a/src/tasks.rs b/src/tasks.rs index ef45c59..8508b78 100644 --- a/src/tasks.rs +++ b/src/tasks.rs @@ -103,7 +103,7 @@ impl Task { } pub fn stop(&mut self) { - if self.when.is_none() { + if self.when.is_some() { self.status = Status::Inbox; } else { self.status = Status::Pending;