From 2b3ba619402a9d6a5408d35bb38ef31f7e488ec5 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 12 Jul 2020 20:35:12 +0530 Subject: remove unused imports, upgrade to cursive v0.15 --- src/app.rs | 4 ++-- src/habit/mod.rs | 9 --------- src/main.rs | 36 ++---------------------------------- src/utils.rs | 2 +- 4 files changed, 5 insertions(+), 46 deletions(-) diff --git a/src/app.rs b/src/app.rs index f8797fc..a64083b 100644 --- a/src/app.rs +++ b/src/app.rs @@ -7,9 +7,9 @@ use cursive::event::{Event, EventResult, Key}; use cursive::view::View; use cursive::{Printer, Vec2}; -use chrono::{Local, NaiveDate}; +use chrono::Local; -use crate::habit::{Bit, Count, Habit, HabitWrapper, ViewMode}; +use crate::habit::{Bit, Count, HabitWrapper, ViewMode}; use crate::utils; use crate::Command; use crate::CONFIGURATION; diff --git a/src/habit/mod.rs b/src/habit/mod.rs index 482ca06..75e734a 100644 --- a/src/habit/mod.rs +++ b/src/habit/mod.rs @@ -1,12 +1,3 @@ -use std::collections::HashMap; - -use chrono::NaiveDate; -use serde::{Deserialize, Serialize}; - -use cursive::direction::Direction; -use cursive::event::{Event, EventResult}; -use cursive::{Printer, Vec2}; - mod traits; pub use traits::{Habit, HabitWrapper}; diff --git a/src/main.rs b/src/main.rs index 387dc64..2313201 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,5 @@ #![allow(unused_must_use)] -use std::default::Default; - mod app; mod command; mod habit; @@ -11,48 +9,18 @@ mod views; use crate::app::App; use crate::command::{open_command_window, Command}; -use crate::habit::{Bit, Count, Habit}; use crate::utils::{load_configuration_file, AppConfig}; -use chrono::NaiveDate; -use cursive::theme::{BaseColor, Color}; +use cursive::crossterm; use cursive::views::NamedView; -use cursive::Cursive; use lazy_static::lazy_static; -use serde::{Deserialize, Serialize}; lazy_static! { pub static ref CONFIGURATION: AppConfig = load_configuration_file(); } fn main() { - let mut s = Cursive::crossterm().unwrap(); - - // let mut gymming = Count::new("gym", 5); - // gymming.insert_entry(NaiveDate::from_ymd(2020, 5, 11), 7); - // gymming.insert_entry(NaiveDate::from_ymd(2020, 5, 12), 8); - // gymming.insert_entry(NaiveDate::from_ymd(2020, 5, 13), 9); - // gymming.insert_entry(NaiveDate::from_ymd(2020, 5, 14), 10); - // gymming.insert_entry(NaiveDate::from_ymd(2020, 5, 15), 11); - - // let mut reading = Bit::new("read"); - // reading.insert_entry(NaiveDate::from_ymd(2020, 5, 11), true.into()); - // reading.insert_entry(NaiveDate::from_ymd(2020, 5, 12), false.into()); - // reading.insert_entry(NaiveDate::from_ymd(2020, 5, 13), true.into()); - // reading.insert_entry(NaiveDate::from_ymd(2020, 5, 14), false.into()); - // reading.insert_entry(NaiveDate::from_ymd(2020, 5, 15), true.into()); - - // let mut walking = Bit::new("walk"); - // walking.insert_entry(NaiveDate::from_ymd(2020, 5, 11), true.into()); - // walking.insert_entry(NaiveDate::from_ymd(2020, 5, 12), false.into()); - // walking.insert_entry(NaiveDate::from_ymd(2020, 5, 13), true.into()); - // walking.insert_entry(NaiveDate::from_ymd(2020, 5, 14), false.into()); - // walking.insert_entry(NaiveDate::from_ymd(2020, 5, 15), true.into()); - - // app.add_habit(Box::new(gymming)); - // app.add_habit(Box::new(reading)); - // app.add_habit(Box::new(walking)); - + let mut s = crossterm().unwrap(); let app = App::load_state(); s.add_layer(NamedView::new("Main", app)); s.add_global_callback(':', |s| open_command_window(s)); diff --git a/src/utils.rs b/src/utils.rs index d23f70d..1d56377 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,7 +1,7 @@ use cursive::theme::{BaseColor, Color}; use directories::ProjectDirs; use std::fs; -use std::path::{Path, PathBuf}; +use std::path::PathBuf; pub struct AppConfig { pub true_chr: char, -- cgit v1.2.3