diff options
author | Akshay <[email protected]> | 2020-07-04 15:07:02 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2020-07-04 15:07:02 +0100 |
commit | b1b8369fe5621ff5b2222977bb357bec15a911e2 (patch) | |
tree | 3c4668178489dd5c47b0cdb9ca7450f5b1eabe3d /src/command.rs | |
parent | 1807562540c6c3c2529d88f8d81b7ceaf82b6fbb (diff) |
new 'delete' command
Diffstat (limited to 'src/command.rs')
-rw-r--r-- | src/command.rs | 10 |
1 files changed, 8 insertions, 2 deletions
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) { | |||
17 | } | 17 | } |
18 | 18 | ||
19 | pub enum Command { | 19 | pub enum Command { |
20 | Add(String, String, Option<u32>), | 20 | Add(String, String, Option<u32>), // habit name, habit type, optional goal |
21 | MonthPrev, | 21 | MonthPrev, |
22 | MonthNext, | 22 | MonthNext, |
23 | Delete, | 23 | Delete(String), |
24 | Blank, | 24 | Blank, |
25 | } | 25 | } |
26 | 26 | ||
@@ -45,6 +45,12 @@ impl Command { | |||
45 | goal, | 45 | goal, |
46 | ); | 46 | ); |
47 | } | 47 | } |
48 | "delete" | "d" => { | ||
49 | if args.len() < 1 { | ||
50 | return Command::Blank; | ||
51 | } | ||
52 | return Command::Delete(args[0].to_string()); | ||
53 | } | ||
48 | "mprev" | "month-prev" => return Command::MonthPrev, | 54 | "mprev" | "month-prev" => return Command::MonthPrev, |
49 | "mnext" | "month-next" => return Command::MonthNext, | 55 | "mnext" | "month-next" => return Command::MonthNext, |
50 | _ => return Command::Blank, | 56 | _ => return Command::Blank, |