aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml2
-rw-r--r--src/app.rs12
-rw-r--r--src/main.rs4
3 files changed, 10 insertions, 8 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 69a1958..17fb40f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -17,7 +17,7 @@ notify = "4.0"
17 17
18[dependencies.cursive] 18[dependencies.cursive]
19version = "0.15" 19version = "0.15"
20features = ["crossterm-backend"] 20features = ["termion-backend"]
21 21
22[dependencies.chrono] 22[dependencies.chrono]
23version = "0.4" 23version = "0.4"
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,
diff --git a/src/main.rs b/src/main.rs
index 3efecd6..dc6081d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -12,7 +12,7 @@ use crate::command::{open_command_window, Command};
12use crate::utils::{load_configuration_file, AppConfig}; 12use crate::utils::{load_configuration_file, AppConfig};
13 13
14use clap::{App as ClapApp, Arg}; 14use clap::{App as ClapApp, Arg};
15use cursive::ncurses; 15use cursive::termion;
16use cursive::views::NamedView; 16use cursive::views::NamedView;
17use lazy_static::lazy_static; 17use lazy_static::lazy_static;
18 18
@@ -44,7 +44,7 @@ fn main() {
44 eprintln!("Invalid or unsupported command!"); 44 eprintln!("Invalid or unsupported command!");
45 } 45 }
46 } else { 46 } else {
47 let mut s = ncurses().unwrap(); 47 let mut s = termion().unwrap();
48 let app = App::load_state(); 48 let app = App::load_state();
49 s.add_layer(NamedView::new("Main", app)); 49 s.add_layer(NamedView::new("Main", app));
50 s.add_global_callback(':', |s| open_command_window(s)); 50 s.add_global_callback(':', |s| open_command_window(s));