From 8490809c538eca6ca123967c855f2b136aad0e76 Mon Sep 17 00:00:00 2001 From: supernovatux Date: Sun, 4 Sep 2022 01:24:17 +0530 Subject: [PATCH] Allow negative offset --- README.md | 5 +++-- src/cli_parser.rs | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 11aa1aa..42f3ca1 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,15 @@ Automatically change brightness depending on screen contents. The program takes a screenshot of the primary screen and calculates its average RGB value and increases/decreases the brightness by a certain value. ## Installation - Git clone the repo and do a cargo build. ```bash git clone https://github.com/Supernovatux/auto_backlight cd auto_backlight cargo build --release - ./target/release/auto_backlight -h + cargo install --path=./ + #Make sure ~/.cargo/bin is in your PATH + auto_backlight -h ``` ## Roadmap diff --git a/src/cli_parser.rs b/src/cli_parser.rs index 388cfbf..4240e61 100644 --- a/src/cli_parser.rs +++ b/src/cli_parser.rs @@ -10,11 +10,13 @@ pub struct Cli { ///Maximum and minimum change to brightness; #[clap(short, long, value_parser, default_value_t = 10)] pub limit: i16, - ///Offset to limit. Use as --offset= - /// if limit=10 - /// offset = -5 + ///Offset to limit. + /// #Example + /// ```bash + /// auto_backlight --offset -5 --limit + /// ``` /// then brightness will vary between -15 to 5; - #[clap(long, value_parser, default_value_t = -7)] + #[clap(long,short,allow_hyphen_values = true ,value_parser, default_value_t = -7)] pub offset: i16, ///Interval in which brightness values are refreshed #[clap(short, long, value_parser, default_value_t = 5)]