aboutsummaryrefslogtreecommitdiff
path: root/src/command.rs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-07-16 17:16:26 +0100
committerAkshay <[email protected]>2020-07-16 17:16:26 +0100
commit7d5e46626110a351104ededeaebdcb9723c7e786 (patch)
tree8d8aa411e0d70120ba6d8e8010de0aef3ddaec9a /src/command.rs
parent10e768b6e6255fda9f6f2a4aaa3c23bb2d829eb1 (diff)
add track commands
Diffstat (limited to 'src/command.rs')
-rw-r--r--src/command.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/command.rs b/src/command.rs
index ae1b307..79d0fe5 100644
--- a/src/command.rs
+++ b/src/command.rs
@@ -11,7 +11,8 @@ pub fn open_command_window(s: &mut Cursive) {
11 11
12fn call_on_app(s: &mut Cursive, input: &str) { 12fn call_on_app(s: &mut Cursive, input: &str) {
13 s.call_on_name("Main", |view: &mut App| { 13 s.call_on_name("Main", |view: &mut App| {
14 view.parse_command(input); 14 let cmd = Command::from_string(input);
15 view.parse_command(cmd);
15 }); 16 });
16 17
17 // special command that requires access to 18 // special command that requires access to
@@ -31,6 +32,8 @@ pub enum Command {
31 MonthPrev, 32 MonthPrev,
32 MonthNext, 33 MonthNext,
33 Delete(String), 34 Delete(String),
35 TrackUp(String),
36 TrackDown(String),
34 Quit, 37 Quit,
35 Blank, 38 Blank,
36} 39}
@@ -59,6 +62,18 @@ impl Command {
59 } 62 }
60 return Command::Delete(args[0].to_string()); 63 return Command::Delete(args[0].to_string());
61 } 64 }
65 "track-up" | "tup" => {
66 if args.len() < 1 {
67 return Command::Blank;
68 }
69 return Command::TrackUp(args[0].to_string());
70 }
71 "track-down" | "tdown" => {
72 if args.len() < 1 {
73 return Command::Blank;
74 }
75 return Command::TrackDown(args[0].to_string());
76 }
62 "mprev" | "month-prev" => return Command::MonthPrev, 77 "mprev" | "month-prev" => return Command::MonthPrev,
63 "mnext" | "month-next" => return Command::MonthNext, 78 "mnext" | "month-next" => return Command::MonthNext,
64 "q" | "quit" => return Command::Quit, 79 "q" | "quit" => return Command::Quit,