mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-25 14:26:58 +00:00
improvements
This commit is contained in:
parent
114e567826
commit
3a8ebca75e
4 changed files with 59 additions and 56 deletions
10
src/main.rs
10
src/main.rs
|
@ -23,22 +23,22 @@ fn main() {
|
|||
Some("raw") => Box::new(RawController::new(p)),
|
||||
Some("lin") => Box::new(LinController::new(p)),
|
||||
Some("log") => Box::new(LogController::new(p)),
|
||||
Some(_) | None => panic!("{}", ERROR_MSG),
|
||||
Some(_) | None => panic!("{ERROR_MSG}"),
|
||||
};
|
||||
|
||||
if matches.is_present("list") {
|
||||
for ctrl in ctrls.keys() {
|
||||
println!("{}", ctrl);
|
||||
println!("{ctrl}");
|
||||
}
|
||||
exit(exitcode::OK);
|
||||
} else if let Some(value) = matches.value_of("set") {
|
||||
let new_value = value.parse::<i32>().unwrap();
|
||||
let new_value = value.parse::<u32>().unwrap();
|
||||
controller.set_brightness(new_value);
|
||||
} else if let Some(value) = matches.value_of("inc") {
|
||||
let new_value = controller.get_brightness() + value.parse::<i32>().unwrap();
|
||||
let new_value = controller.get_brightness() + value.parse::<u32>().unwrap();
|
||||
controller.set_brightness(new_value.min(controller.get_max_brightness()));
|
||||
} else if let Some(value) = matches.value_of("dec") {
|
||||
let new_value = controller.get_brightness() - value.parse::<i32>().unwrap();
|
||||
let new_value = controller.get_brightness() - value.parse::<u32>().unwrap();
|
||||
controller.set_brightness(new_value.max(0));
|
||||
} else if matches.is_present("get") {
|
||||
println!("{}", controller.get_brightness());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue