🐛 Fixed is_some() issues
This commit is contained in:
parent
70760e1aa3
commit
109dbdabbb
@ -14,16 +14,6 @@ fn parse_tags(tags: Option<String>) -> Option<Vec<String>> {
|
|||||||
pub fn show(tasks: &mut Tasks, id: Option<usize>) -> Result<(), TasksError> {
|
pub fn show(tasks: &mut Tasks, id: Option<usize>) -> Result<(), TasksError> {
|
||||||
// If no id is given, print out all tasks
|
// If no id is given, print out all tasks
|
||||||
if let Some(..) = id {
|
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
|
// Get the task the user wants to see
|
||||||
let id = id.unwrap();
|
let id = id.unwrap();
|
||||||
let task = tasks.get_task(id)?;
|
let task = tasks.get_task(id)?;
|
||||||
@ -32,6 +22,14 @@ pub fn show(tasks: &mut Tasks, id: Option<usize>) -> Result<(), TasksError> {
|
|||||||
let table = tables::task_table(task, id);
|
let table = tables::task_table(task, id);
|
||||||
// Print the table
|
// Print the table
|
||||||
println!("{}", 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
|
// Success
|
||||||
|
@ -103,7 +103,7 @@ impl Task {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn stop(&mut self) {
|
pub fn stop(&mut self) {
|
||||||
if self.when.is_none() {
|
if self.when.is_some() {
|
||||||
self.status = Status::Inbox;
|
self.status = Status::Inbox;
|
||||||
} else {
|
} else {
|
||||||
self.status = Status::Pending;
|
self.status = Status::Pending;
|
||||||
|
Loading…
Reference in New Issue
Block a user