From b1b8369fe5621ff5b2222977bb357bec15a911e2 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sat, 4 Jul 2020 19:37:02 +0530 Subject: new 'delete' command --- src/command.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/command.rs') diff --git a/src/command.rs b/src/command.rs index c4f20fc..f94eab8 100644 --- a/src/command.rs +++ b/src/command.rs @@ -17,10 +17,10 @@ fn call_on_app(s: &mut Cursive, input: &str) { } pub enum Command { - Add(String, String, Option), + Add(String, String, Option), // habit name, habit type, optional goal MonthPrev, MonthNext, - Delete, + Delete(String), Blank, } @@ -45,6 +45,12 @@ impl Command { goal, ); } + "delete" | "d" => { + if args.len() < 1 { + return Command::Blank; + } + return Command::Delete(args[0].to_string()); + } "mprev" | "month-prev" => return Command::MonthPrev, "mnext" | "month-next" => return Command::MonthNext, _ => return Command::Blank, -- cgit v1.2.3