aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.rs59
1 files changed, 14 insertions, 45 deletions
diff --git a/src/main.rs b/src/main.rs
index 418ec3b..4f91990 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,63 +1,32 @@
1#![allow(unused_must_use)] 1#![allow(unused_must_use)]
2 2
3use chrono::NaiveDate; 3use std::default::Default;
4
5use lazy_static::lazy_static;
6
7//use cursive::views::{Dialog, EditView, LinearLayout, ListView, SelectView};
8use cursive::theme::{BaseColor, Color};
9use cursive::views::NamedView;
10use cursive::Cursive;
11
12mod habit;
13use crate::habit::{Bit, Count, Habit};
14 4
15mod app; 5mod app;
16mod command; 6mod command;
7mod habit;
17mod theme; 8mod theme;
18use crate::app::{App, ViewMode}; 9mod utils;
19use crate::command::{open_command_window, Command};
20
21mod views; 10mod views;
22 11
23pub struct AppConfig { 12use crate::app::{App, ViewMode};
24 pub true_chr: char, 13use crate::command::{open_command_window, Command};
25 pub false_chr: char, 14use crate::habit::{Bit, Count, Habit};
26 pub future_chr: char, 15use crate::utils::{load_configuration_file, AppConfig};
27
28 // view dimensions
29 pub view_width: usize,
30 pub view_height: usize,
31
32 // app dimensions
33 pub grid_width: usize,
34 16
35 // color config 17use chrono::NaiveDate;
36 pub reached_color: Color, 18use cursive::theme::{BaseColor, Color};
37 pub todo_color: Color, 19use cursive::views::NamedView;
38 pub future_color: Color, 20use cursive::Cursive;
39} 21use lazy_static::lazy_static;
22use serde::{Deserialize, Serialize};
40 23
41lazy_static! { 24lazy_static! {
42 pub static ref CONFIGURATION: AppConfig = load_configuration_file(); 25 pub static ref CONFIGURATION: AppConfig = load_configuration_file();
43} 26}
44 27
45fn load_configuration_file() -> AppConfig {
46 return AppConfig {
47 true_chr: '·',
48 false_chr: '·',
49 future_chr: '·',
50 view_width: 25,
51 view_height: 8,
52 grid_width: 3,
53 reached_color: Color::Dark(BaseColor::Cyan),
54 todo_color: Color::Dark(BaseColor::Magenta),
55 future_color: Color::Light(BaseColor::Black),
56 };
57}
58
59fn main() { 28fn main() {
60 let mut s = Cursive::default(); 29 let mut s = Cursive::crossterm().unwrap();
61 30
62 // let mut gymming = Count::new("gym", 5); 31 // let mut gymming = Count::new("gym", 5);
63 // gymming.insert_entry(NaiveDate::from_ymd(2020, 5, 11), 7); 32 // gymming.insert_entry(NaiveDate::from_ymd(2020, 5, 11), 7);