diff --git a/src/cli.rs b/src/cli.rs index 3d76c00..0ca554e 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -29,7 +29,10 @@ pub struct Cli { #[derive(clap::Parser, std::fmt::Debug)] pub enum Mode { #[command(visible_alias = "r", about = "Reset both pixels and brightness")] - ResetEverything, + Reset { + #[arg(short, long, help = "hard reset screen")] + force: bool, + }, #[command(visible_alias = "p")] Pixels { #[clap(subcommand)] @@ -114,7 +117,7 @@ pub enum BrightnessCommand { #[clap(about = "Commands for sending text to the screen")] pub enum TextCommand { #[command( - about = "Pipe text to the display, example: `journalctl | servicepoint-cli stream stdin`" + about = "Pipe text to the display, example: `journalctl | servicepoint-cli text stdin`" )] Stdin { #[arg( diff --git a/src/main.rs b/src/main.rs index ca8802e..dd32a9e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,7 @@ use crate::{ }; use clap::Parser; use log::debug; -use servicepoint::{Brightness, UdpSocketExt}; +use servicepoint::{Brightness, HardResetCommand, UdpSocketExt}; mod brightness; mod cli; @@ -32,9 +32,13 @@ fn main() { pub fn execute_mode(mode: Mode, connection: UdpSocket) { match mode { - Mode::ResetEverything => { - brightness_set(&connection, Brightness::MAX); - pixels_off(&connection); + Mode::Reset{force} => { + if force { + connection.send_command(HardResetCommand).unwrap() + } else { + brightness_set(&connection, Brightness::MAX); + pixels_off(&connection); + } } Mode::Pixels { pixel_command } => pixels(&connection, pixel_command), Mode::Brightness { brightness_command } => brightness(&connection, brightness_command),