removed cli debug flags; updated error messages

This commit is contained in:
Nickiel12 2023-11-16 17:32:36 -08:00
parent 80fb98c7ac
commit 686e88815c

View file

@ -5,14 +5,11 @@ use serde::{Deserialize, Serialize};
use std::io::stdin; use std::io::stdin;
use std::io::IsTerminal; use std::io::IsTerminal;
use crate::CliArgs; pub fn run_calendar() {
// use serde_json;
pub fn run_calendar(args: &CliArgs) {
let in_pipe = stdin(); let in_pipe = stdin();
if in_pipe.is_terminal() { if in_pipe.is_terminal() {
error!("Calendar Background process requires an input redirection (use a pipe)"); error!("Workspace Selector process requires being run as a terminal process");
panic!("Expected to be used with a pipe, but was not"); panic!("Expected to be run in a terminal process, but was not");
} }
let (mut moonrise, mut moonset, mut moonday, mut sunrise, mut sunset): ( let (mut moonrise, mut moonset, mut moonday, mut sunrise, mut sunset): (
@ -51,9 +48,7 @@ pub fn run_calendar(args: &CliArgs) {
moonphase = match phase.trim()[0..2].parse::<u32>() { moonphase = match phase.trim()[0..2].parse::<u32>() {
Ok(val) => Some(val), Ok(val) => Some(val),
Err(e) => { Err(e) => {
if args.debug { debug!("Error parsing: {e}");
debug!("Error parsing: {e}");
}
None None
} }
}; };
@ -142,7 +137,6 @@ pub fn run_calendar(args: &CliArgs) {
} }
} }
if !output_state.has_bg { if !output_state.has_bg {
println!("linear-gradient(0deg, rgba(26, 26, 26, 1), rgba(50, 50, 50, 1))"); println!("linear-gradient(0deg, rgba(26, 26, 26, 1), rgba(50, 50, 50, 1))");
} else { } else {
@ -152,7 +146,11 @@ pub fn run_calendar(args: &CliArgs) {
"#d3d3d3" "#d3d3d3"
}; };
println!("linear-gradient({}deg, {}, rgba(26, 26, 26, 0.0) 30%)", (output_state.gradient_angle_percentage * 180.0 + 90.0) as i32, gradient_color); println!(
"linear-gradient({}deg, {}, rgba(26, 26, 26, 0.0) 30%)",
(output_state.gradient_angle_percentage * 180.0 + 90.0) as i32,
gradient_color
);
} }
// println!("{}", serde_json::to_string(&output_state).unwrap()); // println!("{}", serde_json::to_string(&output_state).unwrap());