aboutsummaryrefslogtreecommitdiff
path: root/src/app.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/app.rs')
-rw-r--r--src/app.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/app.rs b/src/app.rs
index e8273e3..52c7f5f 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -1,17 +1,17 @@
1use std::default::Default; 1use std::default::Default;
2use std::f64; 2use std::f64;
3use std::time::Duration;
4use std::fs::{File, OpenOptions}; 3use std::fs::{File, OpenOptions};
5use std::io::prelude::*; 4use std::io::prelude::*;
6use std::path::PathBuf; 5use std::path::PathBuf;
7use std::sync::mpsc::{channel, Receiver}; 6use std::sync::mpsc::{channel, Receiver};
7use std::time::Duration;
8 8
9use chrono::Local; 9use chrono::Local;
10use cursive::direction::{Absolute, Direction}; 10use cursive::direction::{Absolute, Direction};
11use cursive::event::{Event, EventResult, Key}; 11use cursive::event::{Event, EventResult, Key};
12use cursive::view::View; 12use cursive::view::View;
13use cursive::{Printer, Vec2}; 13use cursive::{Printer, Vec2};
14use notify::{watcher, RecursiveMode, Watcher, DebouncedEvent, INotifyWatcher}; 14use notify::{watcher, DebouncedEvent, INotifyWatcher, RecursiveMode, Watcher};
15 15
16use crate::habit::{Bit, Count, HabitWrapper, TrackEvent, ViewMode}; 16use crate::habit::{Bit, Count, HabitWrapper, TrackEvent, ViewMode};
17use crate::utils; 17use crate::utils;
@@ -40,9 +40,11 @@ impl App {
40 pub fn new() -> Self { 40 pub fn new() -> Self {
41 let (tx, rx) = channel(); 41 let (tx, rx) = channel();
42 let mut watcher = watcher(tx, Duration::from_secs(1)).unwrap(); 42 let mut watcher = watcher(tx, Duration::from_secs(1)).unwrap();
43 watcher.watch(utils::auto_habit_file(), RecursiveMode::Recursive).unwrap_or_else(|e| { 43 watcher
44 panic!("Unable to start file watcher: {}", e); 44 .watch(utils::auto_habit_file(), RecursiveMode::Recursive)
45 }); 45 .unwrap_or_else(|e| {
46 panic!("Unable to start file watcher: {}", e);
47 });
46 return App { 48 return App {
47 habits: vec![], 49 habits: vec![],
48 focus: 0, 50 focus: 0,