Dropped --fancy option.

This commit is contained in:
shy 2021-04-22 07:44:58 +02:00
parent 186273c907
commit e4979bdd35
7 changed files with 7 additions and 41 deletions

2
Cargo.lock generated
View file

@ -8,7 +8,7 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
[[package]] [[package]]
name = "kitchentimer" name = "kitchentimer"
version = "0.1.1" version = "0.2.0"
dependencies = [ dependencies = [
"signal-hook", "signal-hook",
"termion", "termion",

View file

@ -1,6 +1,6 @@
[package] [package]
name = "kitchentimer" name = "kitchentimer"
version = "0.1.1" version = "0.2.0"
authors = ["Shy <shy@posteo.de>"] authors = ["Shy <shy@posteo.de>"]
license = "GPL-3.0-or-later" license = "GPL-3.0-or-later"
edition = "2018" edition = "2018"

View file

@ -25,7 +25,6 @@ interactively.
times. Occurrences of {l} will be replaced by the times. Occurrences of {l} will be replaced by the
alarm label, {t} by alarm time in (HH:)MM:SS format. alarm label, {t} by alarm time in (HH:)MM:SS format.
-p, --plain Use simpler block chars to draw the clock. -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. -q, --quit Quit program after last alarm.
SIGNALS: <SIGUSR1> Reset clock. SIGNALS: <SIGUSR1> Reset clock.

View file

@ -19,7 +19,6 @@ use crate::clock::Clock;
use crate::consts::{COLOR, LABEL_SIZE_LIMIT}; use crate::consts::{COLOR, LABEL_SIZE_LIMIT};
use crate::layout::{Layout, Position}; use crate::layout::{Layout, Position};
use crate::utils::*; use crate::utils::*;
use crate::Config;
use std::io::BufRead; use std::io::BufRead;
use std::io::Write; use std::io::Write;
use termion::raw::RawTerminal; use termion::raw::RawTerminal;
@ -293,7 +292,6 @@ impl AlarmRoster {
&mut self, &mut self,
stdout: &mut RawTerminal<W>, stdout: &mut RawTerminal<W>,
layout: &mut Layout, layout: &mut Layout,
config: &Config,
) -> Result<(), std::io::Error> { ) -> Result<(), std::io::Error> {
// Adjust offset in case something changed, e.g. the terminal size. // Adjust offset in case something changed, e.g. the terminal size.
self.adjust_offset(&layout); self.adjust_offset(&layout);
@ -305,10 +303,9 @@ impl AlarmRoster {
// Indicate hidden items at top. // Indicate hidden items at top.
write!( write!(
stdout, stdout,
"{}{}{}{}", "{}{}[ ^ ]{}",
cursor::Goto(layout.roster.col, line), cursor::Goto(layout.roster.col, line),
style::Faint, style::Faint,
if config.fancy { "╶╴▲╶╴" } else { "[ ^ ]" },
style::Reset, style::Reset,
)?; )?;
continue; continue;
@ -316,10 +313,9 @@ impl AlarmRoster {
// Indicate hidden items at bottom. // Indicate hidden items at bottom.
write!( write!(
stdout, stdout,
"{}{}{}{}{}", "{}{}[ v ]{}{}",
cursor::Goto(layout.roster.col, line), cursor::Goto(layout.roster.col, line),
style::Faint, style::Faint,
if config.fancy { "╶╴▼╶╴" } else { "[ v ]" },
if !self.hints_shown { if !self.hints_shown {
self.hints_shown = true; self.hints_shown = true;
" [Page Up/Down]" " [Page Up/Down]"
@ -332,30 +328,6 @@ impl AlarmRoster {
} }
match alarm.exceeded { 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 => { true => {
write!( write!(
stdout, stdout,

View file

@ -200,6 +200,7 @@ pub const PLAIN: Font = Font {
], ],
}; };
/*
pub const CHROME: Font = Font { pub const CHROME: Font = Font {
height: DIGIT_HEIGHT, height: DIGIT_HEIGHT,
width: 5, width: 5,
@ -287,3 +288,4 @@ pub const CHROME: Font = Font {
], ],
], ],
}; };
*/

View file

@ -46,7 +46,6 @@ OPTIONS:
times. Occurrences of {l} will be replaced by the times. Occurrences of {l} will be replaced by the
alarm label, {t} by alarm time in (HH:)MM:SS format. alarm label, {t} by alarm time in (HH:)MM:SS format.
-p, --plain Use simpler block chars to draw the clock. -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. -q, --quit Quit program after last alarm.
SIGNALS: <SIGUSR1> Reset clock. SIGNALS: <SIGUSR1> Reset clock.

View file

@ -190,7 +190,7 @@ pub fn run(
)?; )?;
// Redraw list of alarms. // Redraw list of alarms.
alarm_roster.draw(&mut stdout, &mut layout, &config)?; alarm_roster.draw(&mut stdout, &mut layout)?;
// Redraw buffer. // Redraw buffer.
buffer.draw(&mut stdout, &mut layout)?; buffer.draw(&mut stdout, &mut layout)?;
@ -359,7 +359,6 @@ pub fn run(
pub struct Config { pub struct Config {
quit: bool, quit: bool,
fancy: bool,
font: &'static font::Font, font: &'static font::Font,
commands: Cradle, commands: Cradle,
} }
@ -372,7 +371,6 @@ impl Config {
) -> Result<Config, String> { ) -> Result<Config, String> {
let mut config = Config { let mut config = Config {
quit: false, quit: false,
fancy: false,
font: &font::NORMAL, font: &font::NORMAL,
commands: Cradle::new(), commands: Cradle::new(),
}; };
@ -390,10 +388,6 @@ impl Config {
process::exit(0); process::exit(0);
} }
"-p" | "--plain" => config.font = &font::PLAIN, "-p" | "--plain" => config.font = &font::PLAIN,
"-f" | "--fancy" => {
config.fancy = true;
config.font = &font::CHROME;
}
"-q" | "--quit" => config.quit = true, "-q" | "--quit" => config.quit = true,
"-e" | "--exec" => { "-e" | "--exec" => {
if let Some(cmd) = iter.next() { if let Some(cmd) = iter.next() {