aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml5
-rw-r--r--src/main.rs59
2 files changed, 18 insertions, 46 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 3fea17f..593963b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,12 +7,15 @@ edition = "2018"
7# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8 8
9[dependencies] 9[dependencies]
10cursive = "0.14"
11serde_json = "1.0" 10serde_json = "1.0"
12lazy_static = "1.4.0" 11lazy_static = "1.4.0"
13erased-serde = "0.3" 12erased-serde = "0.3"
14typetag = "0.1.4" 13typetag = "0.1.4"
15 14
15[dependencies.cursive]
16version = "0.14"
17features = ["crossterm-backend"]
18
16[dependencies.chrono] 19[dependencies.chrono]
17version = "0.4" 20version = "0.4"
18features = ["serde"] 21features = ["serde"]
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);