diff options
-rw-r--r-- | src/app.rs | 4 | ||||
-rw-r--r-- | src/habit/mod.rs | 9 | ||||
-rw-r--r-- | src/main.rs | 36 | ||||
-rw-r--r-- | src/utils.rs | 2 |
4 files changed, 5 insertions, 46 deletions
@@ -7,9 +7,9 @@ use cursive::event::{Event, EventResult, Key}; | |||
7 | use cursive::view::View; | 7 | use cursive::view::View; |
8 | use cursive::{Printer, Vec2}; | 8 | use cursive::{Printer, Vec2}; |
9 | 9 | ||
10 | use chrono::{Local, NaiveDate}; | 10 | use chrono::Local; |
11 | 11 | ||
12 | use crate::habit::{Bit, Count, Habit, HabitWrapper, ViewMode}; | 12 | use crate::habit::{Bit, Count, HabitWrapper, ViewMode}; |
13 | use crate::utils; | 13 | use crate::utils; |
14 | use crate::Command; | 14 | use crate::Command; |
15 | use crate::CONFIGURATION; | 15 | use crate::CONFIGURATION; |
diff --git a/src/habit/mod.rs b/src/habit/mod.rs index 482ca06..75e734a 100644 --- a/src/habit/mod.rs +++ b/src/habit/mod.rs | |||
@@ -1,12 +1,3 @@ | |||
1 | use std::collections::HashMap; | ||
2 | |||
3 | use chrono::NaiveDate; | ||
4 | use serde::{Deserialize, Serialize}; | ||
5 | |||
6 | use cursive::direction::Direction; | ||
7 | use cursive::event::{Event, EventResult}; | ||
8 | use cursive::{Printer, Vec2}; | ||
9 | |||
10 | mod traits; | 1 | mod traits; |
11 | pub use traits::{Habit, HabitWrapper}; | 2 | pub use traits::{Habit, HabitWrapper}; |
12 | 3 | ||
diff --git a/src/main.rs b/src/main.rs index 387dc64..2313201 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -1,7 +1,5 @@ | |||
1 | #![allow(unused_must_use)] | 1 | #![allow(unused_must_use)] |
2 | 2 | ||
3 | use std::default::Default; | ||
4 | |||
5 | mod app; | 3 | mod app; |
6 | mod command; | 4 | mod command; |
7 | mod habit; | 5 | mod habit; |
@@ -11,48 +9,18 @@ mod views; | |||
11 | 9 | ||
12 | use crate::app::App; | 10 | use crate::app::App; |
13 | use crate::command::{open_command_window, Command}; | 11 | use crate::command::{open_command_window, Command}; |
14 | use crate::habit::{Bit, Count, Habit}; | ||
15 | use crate::utils::{load_configuration_file, AppConfig}; | 12 | use crate::utils::{load_configuration_file, AppConfig}; |
16 | 13 | ||
17 | use chrono::NaiveDate; | 14 | use cursive::crossterm; |
18 | use cursive::theme::{BaseColor, Color}; | ||
19 | use cursive::views::NamedView; | 15 | use cursive::views::NamedView; |
20 | use cursive::Cursive; | ||
21 | use lazy_static::lazy_static; | 16 | use lazy_static::lazy_static; |
22 | use serde::{Deserialize, Serialize}; | ||
23 | 17 | ||
24 | lazy_static! { | 18 | lazy_static! { |
25 | pub static ref CONFIGURATION: AppConfig = load_configuration_file(); | 19 | pub static ref CONFIGURATION: AppConfig = load_configuration_file(); |
26 | } | 20 | } |
27 | 21 | ||
28 | fn main() { | 22 | fn main() { |
29 | let mut s = Cursive::crossterm().unwrap(); | 23 | let mut s = crossterm().unwrap(); |
30 | |||
31 | // let mut gymming = Count::new("gym", 5); | ||
32 | // gymming.insert_entry(NaiveDate::from_ymd(2020, 5, 11), 7); | ||
33 | // gymming.insert_entry(NaiveDate::from_ymd(2020, 5, 12), 8); | ||
34 | // gymming.insert_entry(NaiveDate::from_ymd(2020, 5, 13), 9); | ||
35 | // gymming.insert_entry(NaiveDate::from_ymd(2020, 5, 14), 10); | ||
36 | // gymming.insert_entry(NaiveDate::from_ymd(2020, 5, 15), 11); | ||
37 | |||
38 | // let mut reading = Bit::new("read"); | ||
39 | // reading.insert_entry(NaiveDate::from_ymd(2020, 5, 11), true.into()); | ||
40 | // reading.insert_entry(NaiveDate::from_ymd(2020, 5, 12), false.into()); | ||
41 | // reading.insert_entry(NaiveDate::from_ymd(2020, 5, 13), true.into()); | ||
42 | // reading.insert_entry(NaiveDate::from_ymd(2020, 5, 14), false.into()); | ||
43 | // reading.insert_entry(NaiveDate::from_ymd(2020, 5, 15), true.into()); | ||
44 | |||
45 | // let mut walking = Bit::new("walk"); | ||
46 | // walking.insert_entry(NaiveDate::from_ymd(2020, 5, 11), true.into()); | ||
47 | // walking.insert_entry(NaiveDate::from_ymd(2020, 5, 12), false.into()); | ||
48 | // walking.insert_entry(NaiveDate::from_ymd(2020, 5, 13), true.into()); | ||
49 | // walking.insert_entry(NaiveDate::from_ymd(2020, 5, 14), false.into()); | ||
50 | // walking.insert_entry(NaiveDate::from_ymd(2020, 5, 15), true.into()); | ||
51 | |||
52 | // app.add_habit(Box::new(gymming)); | ||
53 | // app.add_habit(Box::new(reading)); | ||
54 | // app.add_habit(Box::new(walking)); | ||
55 | |||
56 | let app = App::load_state(); | 24 | let app = App::load_state(); |
57 | s.add_layer(NamedView::new("Main", app)); | 25 | s.add_layer(NamedView::new("Main", app)); |
58 | s.add_global_callback(':', |s| open_command_window(s)); | 26 | s.add_global_callback(':', |s| open_command_window(s)); |
diff --git a/src/utils.rs b/src/utils.rs index d23f70d..1d56377 100644 --- a/src/utils.rs +++ b/src/utils.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | use cursive::theme::{BaseColor, Color}; | 1 | use cursive::theme::{BaseColor, Color}; |
2 | use directories::ProjectDirs; | 2 | use directories::ProjectDirs; |
3 | use std::fs; | 3 | use std::fs; |
4 | use std::path::{Path, PathBuf}; | 4 | use std::path::PathBuf; |
5 | 5 | ||
6 | pub struct AppConfig { | 6 | pub struct AppConfig { |
7 | pub true_chr: char, | 7 | pub true_chr: char, |