Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
TiagoRCorreia committed Dec 30, 2022
2 parents b68b680 + c0b89b5 commit c3cd7e2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
17 changes: 9 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub fn add_todo(td: &mut Vec<Todo>) -> Result<(), Box<dyn std::error::Error>> {
print!("{}{}", "Title ".white().bold(), "-> ".green().bold());
let title = user_input()?.trim().to_string();

print!("{}{}", "Description".white().bold(), "-> ".green().bold());
print!("{}{}", "Description ".white().bold(), "-> ".green().bold());
let desc = user_input()?.trim().to_string();

td.push(Todo::new(
Expand Down Expand Up @@ -233,7 +233,7 @@ pub fn set_done(td: &mut [Todo]) -> Result<(), Box<dyn std::error::Error>> {
print!(
"\n{} {}{}",
"ID".red().bold(),
"to mark as done -> ".white().bold(),
"to mark it as done ".white().bold(),
"-> ".green().bold()
);

Expand All @@ -248,7 +248,7 @@ pub fn set_undone(td: &mut [Todo]) -> Result<(), Box<dyn std::error::Error>> {
print!(
"\n{} {}{}",
"ID".red().bold(),
"to mark as undone -> ".white().bold(),
"to mark it as undone ".white().bold(),
"-> ".green().bold()
);

Expand All @@ -274,21 +274,22 @@ pub fn set_priority(td: &mut [Todo]) -> Result<(), Box<dyn std::error::Error>> {
print!(
"\n{} {}{}",
"ID".red().bold(),
"to set the Priority -> ".white().bold(),
"to set the Priority ".white().bold(),
"-> ".green().bold()
);
// Get id from the user
let id = user_input()?.trim().to_string().parse::<usize>()?;

// Display menu priority
print!(
"\n{}{} {}{} {}{}",
"\n{}{} {}{} {}{} {}",
"[1]".blue().bold(),
" Low".green().bold(),
"Low".green().bold(),
"[2]".blue().bold(),
" MEDIUM ".yellow().bold(),
"MEDIUM ".yellow().bold(),
"[3]".blue().bold(),
" HIGH -> ".red().bold()
"HIGH ".red().bold(),
"-> ".green().bold(),
);

// Get priority from the user
Expand Down
8 changes: 4 additions & 4 deletions src/sorting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ pub fn sorting_control(td: &mut [Todo]) -> Result<(), Box<dyn std::error::Error>
print!(
"\n\n{}{} {}{} {}",
"[1]".blue().bold(),
"Done".red().bold(),
"Done".green().bold(),
"[2]".blue().bold(),
"Undone".green().bold(),
"-> ".white().bold(),
"Undone".red().bold(),
"-> ".green().bold(),
);

// Get user input
Expand All @@ -57,7 +57,7 @@ pub fn sorting_control(td: &mut [Todo]) -> Result<(), Box<dyn std::error::Error>
"MEDIUM".yellow().bold(),
"[3]".blue().bold(),
"HIGH".red().bold(),
"-> ".white().bold(),
"-> ".green().bold(),
);

let sort_priority = user_input()?.trim().to_string();
Expand Down

0 comments on commit c3cd7e2

Please sign in to comment.