aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-07-23 08:37:35 +0100
committerAkshay <[email protected]>2020-07-23 08:37:35 +0100
commit537e4f5ebe7404031f240233cbe9807df0d580d9 (patch)
tree7de9e379217180ccee20f6c74681df36071a893c /src/main.rs
parent59b40932d4602fc7bf84f123930f9a0eb187f4a1 (diff)
parenta0c57162b2026e37220e31a39d821c2a2e31cc51 (diff)
Merge branch 'master' of https://github.com/yoms/dijo into fix/duplicate-habits
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index d96119e..050a296 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -33,6 +33,14 @@ fn main() {
33 .value_name("CMD") 33 .value_name("CMD")
34 .help("run a dijo command"), 34 .help("run a dijo command"),
35 ) 35 )
36 .arg(
37 Arg::with_name("list")
38 .short("l")
39 .long("list")
40 .takes_value(false)
41 .help("list dijo habits")
42 .conflicts_with("command"),
43 )
36 .get_matches(); 44 .get_matches();
37 if let Some(c) = matches.value_of("command") { 45 if let Some(c) = matches.value_of("command") {
38 let command = Command::from_string(c); 46 let command = Command::from_string(c);
@@ -49,6 +57,12 @@ fn main() {
49 "Commands other than `track-up` and `track-down` are currently not supported!" 57 "Commands other than `track-up` and `track-down` are currently not supported!"
50 ), 58 ),
51 } 59 }
60 } else if matches.is_present("list") {
61 let app = App::load_state();
62 let _habit_names = app.list_habit();
63 for h in _habit_names {
64 println!("{}", h);
65 }
52 } else { 66 } else {
53 let mut s = termion().unwrap(); 67 let mut s = termion().unwrap();
54 let app = App::load_state(); 68 let app = App::load_state();