aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-06-30 05:41:56 +0100
committerAkshay <[email protected]>2020-06-30 05:41:56 +0100
commit775f3486a9066dfc8cb1f31e6c5b26be253d05ed (patch)
tree441a355d6fcf22e56ad132a9e656a1fb7d0efe63 /src/main.rs
parent501e44c193cc6dd1299956f1ab85465a444b84a2 (diff)
access command mode via ':' and basic command parsing
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 3e838e5..418ec3b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -6,14 +6,17 @@ use lazy_static::lazy_static;
6 6
7//use cursive::views::{Dialog, EditView, LinearLayout, ListView, SelectView}; 7//use cursive::views::{Dialog, EditView, LinearLayout, ListView, SelectView};
8use cursive::theme::{BaseColor, Color}; 8use cursive::theme::{BaseColor, Color};
9use cursive::views::NamedView;
9use cursive::Cursive; 10use cursive::Cursive;
10 11
11mod habit; 12mod habit;
12use crate::habit::{Bit, Count, Habit}; 13use crate::habit::{Bit, Count, Habit};
13 14
14mod app; 15mod app;
16mod command;
15mod theme; 17mod theme;
16use crate::app::{App, ViewMode}; 18use crate::app::{App, ViewMode};
19use crate::command::{open_command_window, Command};
17 20
18mod views; 21mod views;
19 22
@@ -77,13 +80,13 @@ fn main() {
77 // walking.insert_entry(NaiveDate::from_ymd(2020, 5, 14), false.into()); 80 // walking.insert_entry(NaiveDate::from_ymd(2020, 5, 14), false.into());
78 // walking.insert_entry(NaiveDate::from_ymd(2020, 5, 15), true.into()); 81 // walking.insert_entry(NaiveDate::from_ymd(2020, 5, 15), true.into());
79 82
80 // let mut app = App::new();
81 // app.add_habit(Box::new(gymming)); 83 // app.add_habit(Box::new(gymming));
82 // app.add_habit(Box::new(reading)); 84 // app.add_habit(Box::new(reading));
83 // app.add_habit(Box::new(walking)); 85 // app.add_habit(Box::new(walking));
84 86
85 let app = App::load_state(); 87 let app = App::load_state();
86 s.add_layer(app); 88 s.add_layer(NamedView::new("Main", app));
89 s.add_global_callback(':', |s| open_command_window(s));
87 90
88 s.set_theme(theme::theme_gen()); 91 s.set_theme(theme::theme_gen());
89 s.run(); 92 s.run();