aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs
index dc6081d..f83fc83 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -36,12 +36,18 @@ fn main() {
36 .get_matches(); 36 .get_matches();
37 if let Some(c) = matches.value_of("command") { 37 if let Some(c) = matches.value_of("command") {
38 let command = Command::from_string(c); 38 let command = Command::from_string(c);
39 if matches!(command, Command::TrackUp(_) | Command::TrackDown(_)) { 39 match command {
40 let mut app = App::load_state(); 40 Ok(Command::TrackUp(_)) | Ok(Command::TrackDown(_)) => {
41 app.parse_command(command); 41 let mut app = App::load_state();
42 app.save_state(); 42 app.parse_command(command);
43 } else { 43 app.save_state();
44 eprintln!("Invalid or unsupported command!"); 44 }
45 Err(e) => {
46 eprintln!("{}", e);
47 }
48 _ => eprintln!(
49 "Commands other than `track-up` and `track-down` are currently not supported!"
50 ),
45 } 51 }
46 } else { 52 } else {
47 let mut s = termion().unwrap(); 53 let mut s = termion().unwrap();