From e4979bdd358d8cdad8a48ffa347380c6ee799e46 Mon Sep 17 00:00:00 2001 From: shy Date: Thu, 22 Apr 2021 07:44:58 +0200 Subject: [PATCH] Dropped --fancy option. --- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 1 - src/alarm.rs | 32 ++------------------------------ src/clock/font.rs | 2 ++ src/consts.rs | 1 - src/lib.rs | 8 +------- 7 files changed, 7 insertions(+), 41 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 39972bd..50dec60 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,7 +8,7 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "kitchentimer" -version = "0.1.1" +version = "0.2.0" dependencies = [ "signal-hook", "termion", diff --git a/Cargo.toml b/Cargo.toml index 943b0ea..f556a69 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "kitchentimer" -version = "0.1.1" +version = "0.2.0" authors = ["Shy "] license = "GPL-3.0-or-later" edition = "2018" diff --git a/README.md b/README.md index 5f2f7fa..24fc82b 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,6 @@ interactively. times. Occurrences of {l} will be replaced by the alarm label, {t} by alarm time in (HH:)MM:SS format. -p, --plain Use simpler block chars to draw the clock. - -f, --fancy Make use of less common unicode characters. -q, --quit Quit program after last alarm. SIGNALS: Reset clock. diff --git a/src/alarm.rs b/src/alarm.rs index cfbb570..4743ad1 100644 --- a/src/alarm.rs +++ b/src/alarm.rs @@ -19,7 +19,6 @@ use crate::clock::Clock; use crate::consts::{COLOR, LABEL_SIZE_LIMIT}; use crate::layout::{Layout, Position}; use crate::utils::*; -use crate::Config; use std::io::BufRead; use std::io::Write; use termion::raw::RawTerminal; @@ -293,7 +292,6 @@ impl AlarmRoster { &mut self, stdout: &mut RawTerminal, layout: &mut Layout, - config: &Config, ) -> Result<(), std::io::Error> { // Adjust offset in case something changed, e.g. the terminal size. self.adjust_offset(&layout); @@ -305,10 +303,9 @@ impl AlarmRoster { // Indicate hidden items at top. write!( stdout, - "{}{}{}{}", + "{}{}[ ^ ]{}", cursor::Goto(layout.roster.col, line), style::Faint, - if config.fancy { "╶╴▲╶╴" } else { "[ ^ ]" }, style::Reset, )?; continue; @@ -316,10 +313,9 @@ impl AlarmRoster { // Indicate hidden items at bottom. write!( stdout, - "{}{}{}{}{}", + "{}{}[ v ]{}{}", cursor::Goto(layout.roster.col, line), style::Faint, - if config.fancy { "╶╴▼╶╴" } else { "[ v ]" }, if !self.hints_shown { self.hints_shown = true; " [Page Up/Down]" @@ -332,30 +328,6 @@ impl AlarmRoster { } match alarm.exceeded { - true if config.fancy => { - write!( - stdout, - "{}{}{}{} {} {}🭬{}{}", - cursor::Goto(layout.roster.col, line), - color::Fg(COLOR[alarm.color_index]), - style::Bold, - style::Invert, - &alarm.label, - style::NoInvert, - style::Reset, - color::Fg(color::Reset), - )?; - } - false if config.fancy => { - write!( - stdout, - "{}{}█🭬{}{}", - cursor::Goto(layout.roster.col, line), - color::Fg(COLOR[alarm.color_index]), - color::Fg(color::Reset), - &alarm.label, - )?; - } true => { write!( stdout, diff --git a/src/clock/font.rs b/src/clock/font.rs index b9c3427..c15493a 100644 --- a/src/clock/font.rs +++ b/src/clock/font.rs @@ -200,6 +200,7 @@ pub const PLAIN: Font = Font { ], }; +/* pub const CHROME: Font = Font { height: DIGIT_HEIGHT, width: 5, @@ -287,3 +288,4 @@ pub const CHROME: Font = Font { ], ], }; +*/ diff --git a/src/consts.rs b/src/consts.rs index c419a45..d7e94d0 100644 --- a/src/consts.rs +++ b/src/consts.rs @@ -46,7 +46,6 @@ OPTIONS: times. Occurrences of {l} will be replaced by the alarm label, {t} by alarm time in (HH:)MM:SS format. -p, --plain Use simpler block chars to draw the clock. - -f, --fancy Make use of less common unicode characters. -q, --quit Quit program after last alarm. SIGNALS: Reset clock. diff --git a/src/lib.rs b/src/lib.rs index 2323cba..8db960b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -190,7 +190,7 @@ pub fn run( )?; // Redraw list of alarms. - alarm_roster.draw(&mut stdout, &mut layout, &config)?; + alarm_roster.draw(&mut stdout, &mut layout)?; // Redraw buffer. buffer.draw(&mut stdout, &mut layout)?; @@ -359,7 +359,6 @@ pub fn run( pub struct Config { quit: bool, - fancy: bool, font: &'static font::Font, commands: Cradle, } @@ -372,7 +371,6 @@ impl Config { ) -> Result { let mut config = Config { quit: false, - fancy: false, font: &font::NORMAL, commands: Cradle::new(), }; @@ -390,10 +388,6 @@ impl Config { process::exit(0); } "-p" | "--plain" => config.font = &font::PLAIN, - "-f" | "--fancy" => { - config.fancy = true; - config.font = &font::CHROME; - } "-q" | "--quit" => config.quit = true, "-e" | "--exec" => { if let Some(cmd) = iter.next() {