Dropped --fancy option.
This commit is contained in:
parent
186273c907
commit
e4979bdd35
7 changed files with 7 additions and 41 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -8,7 +8,7 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
|||
|
||||
[[package]]
|
||||
name = "kitchentimer"
|
||||
version = "0.1.1"
|
||||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"signal-hook",
|
||||
"termion",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "kitchentimer"
|
||||
version = "0.1.1"
|
||||
version = "0.2.0"
|
||||
authors = ["Shy <shy@posteo.de>"]
|
||||
license = "GPL-3.0-or-later"
|
||||
edition = "2018"
|
||||
|
|
|
@ -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: <SIGUSR1> Reset clock.
|
||||
|
|
32
src/alarm.rs
32
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<W>,
|
||||
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,
|
||||
|
|
|
@ -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 {
|
|||
],
|
||||
],
|
||||
};
|
||||
*/
|
||||
|
|
|
@ -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: <SIGUSR1> Reset clock.
|
||||
|
|
|
@ -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<Config, String> {
|
||||
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() {
|
||||
|
|
Loading…
Reference in a new issue