From 775f3486a9066dfc8cb1f31e6c5b26be253d05ed Mon Sep 17 00:00:00 2001 From: Akshay Date: Tue, 30 Jun 2020 10:11:56 +0530 Subject: access command mode via ':' and basic command parsing --- src/main.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/main.rs') 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; //use cursive::views::{Dialog, EditView, LinearLayout, ListView, SelectView}; use cursive::theme::{BaseColor, Color}; +use cursive::views::NamedView; use cursive::Cursive; mod habit; use crate::habit::{Bit, Count, Habit}; mod app; +mod command; mod theme; use crate::app::{App, ViewMode}; +use crate::command::{open_command_window, Command}; mod views; @@ -77,13 +80,13 @@ fn main() { // walking.insert_entry(NaiveDate::from_ymd(2020, 5, 14), false.into()); // walking.insert_entry(NaiveDate::from_ymd(2020, 5, 15), true.into()); - // let mut app = App::new(); // app.add_habit(Box::new(gymming)); // app.add_habit(Box::new(reading)); // app.add_habit(Box::new(walking)); let app = App::load_state(); - s.add_layer(app); + s.add_layer(NamedView::new("Main", app)); + s.add_global_callback(':', |s| open_command_window(s)); s.set_theme(theme::theme_gen()); s.run(); -- cgit v1.2.3