aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app.rs4
-rw-r--r--src/habit/mod.rs9
-rw-r--r--src/main.rs36
-rw-r--r--src/utils.rs2
4 files changed, 5 insertions, 46 deletions
diff --git a/src/app.rs b/src/app.rs
index f8797fc..a64083b 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -7,9 +7,9 @@ use cursive::event::{Event, EventResult, Key};
7use cursive::view::View; 7use cursive::view::View;
8use cursive::{Printer, Vec2}; 8use cursive::{Printer, Vec2};
9 9
10use chrono::{Local, NaiveDate}; 10use chrono::Local;
11 11
12use crate::habit::{Bit, Count, Habit, HabitWrapper, ViewMode}; 12use crate::habit::{Bit, Count, HabitWrapper, ViewMode};
13use crate::utils; 13use crate::utils;
14use crate::Command; 14use crate::Command;
15use crate::CONFIGURATION; 15use 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 @@
1use std::collections::HashMap;
2
3use chrono::NaiveDate;
4use serde::{Deserialize, Serialize};
5
6use cursive::direction::Direction;
7use cursive::event::{Event, EventResult};
8use cursive::{Printer, Vec2};
9
10mod traits; 1mod traits;
11pub use traits::{Habit, HabitWrapper}; 2pub 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
3use std::default::Default;
4
5mod app; 3mod app;
6mod command; 4mod command;
7mod habit; 5mod habit;
@@ -11,48 +9,18 @@ mod views;
11 9
12use crate::app::App; 10use crate::app::App;
13use crate::command::{open_command_window, Command}; 11use crate::command::{open_command_window, Command};
14use crate::habit::{Bit, Count, Habit};
15use crate::utils::{load_configuration_file, AppConfig}; 12use crate::utils::{load_configuration_file, AppConfig};
16 13
17use chrono::NaiveDate; 14use cursive::crossterm;
18use cursive::theme::{BaseColor, Color};
19use cursive::views::NamedView; 15use cursive::views::NamedView;
20use cursive::Cursive;
21use lazy_static::lazy_static; 16use lazy_static::lazy_static;
22use serde::{Deserialize, Serialize};
23 17
24lazy_static! { 18lazy_static! {
25 pub static ref CONFIGURATION: AppConfig = load_configuration_file(); 19 pub static ref CONFIGURATION: AppConfig = load_configuration_file();
26} 20}
27 21
28fn main() { 22fn 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 @@
1use cursive::theme::{BaseColor, Color}; 1use cursive::theme::{BaseColor, Color};
2use directories::ProjectDirs; 2use directories::ProjectDirs;
3use std::fs; 3use std::fs;
4use std::path::{Path, PathBuf}; 4use std::path::PathBuf;
5 5
6pub struct AppConfig { 6pub struct AppConfig {
7 pub true_chr: char, 7 pub true_chr: char,