Apply suggested formatting from rustfmt
This commit is contained in:
parent
19c65e6c7a
commit
25860caa84
55
src/main.rs
55
src/main.rs
|
@ -1,11 +1,11 @@
|
|||
extern crate glob;
|
||||
extern crate clap;
|
||||
use clap::{Arg, App};
|
||||
extern crate glob;
|
||||
use clap::{App, Arg};
|
||||
use glob::glob;
|
||||
use std::fs;
|
||||
use std::process::Command;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use std::process::Command;
|
||||
use glob::glob;
|
||||
|
||||
fn main() {
|
||||
let mut mode = "";
|
||||
|
@ -16,17 +16,10 @@ fn main() {
|
|||
let mut matrix: [&str; 9];
|
||||
let mut x_state: &str;
|
||||
|
||||
let sway_pid = String::from_utf8(Command::new("pidof")
|
||||
.arg("sway")
|
||||
.output()
|
||||
.unwrap()
|
||||
.stdout).unwrap();
|
||||
let sway_pid =
|
||||
String::from_utf8(Command::new("pidof").arg("sway").output().unwrap().stdout).unwrap();
|
||||
|
||||
let x_pid = String::from_utf8(Command::new("pidof")
|
||||
.arg("x")
|
||||
.output()
|
||||
.unwrap()
|
||||
.stdout).unwrap();
|
||||
let x_pid = String::from_utf8(Command::new("pidof").arg("x").output().unwrap().stdout).unwrap();
|
||||
|
||||
if sway_pid.len() >= 1 {
|
||||
mode = "sway";
|
||||
|
@ -37,24 +30,30 @@ fn main() {
|
|||
|
||||
let matches = App::new("rot8")
|
||||
.version("0.1.1")
|
||||
.arg(Arg::with_name("sleep")
|
||||
.arg(
|
||||
Arg::with_name("sleep")
|
||||
.default_value("500")
|
||||
.long("sleep")
|
||||
.value_name("SLEEP")
|
||||
.help("Set sleep millis")
|
||||
.takes_value(true))
|
||||
.arg(Arg::with_name("display")
|
||||
.takes_value(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("display")
|
||||
.default_value("eDP-1")
|
||||
.long("display")
|
||||
.value_name("DISPLAY")
|
||||
.help("Set Display Device")
|
||||
.takes_value(true))
|
||||
.arg(Arg::with_name("touchscreen")
|
||||
.takes_value(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("touchscreen")
|
||||
.default_value("ELAN0732:00 04F3:22E1")
|
||||
.long("touchscreen")
|
||||
.value_name("TOUCHSCREEN")
|
||||
.help("Set Touchscreen Device (X11)")
|
||||
.takes_value(true))
|
||||
.takes_value(true),
|
||||
)
|
||||
.get_matches();
|
||||
let sleep = matches.value_of("sleep").unwrap_or("default.conf");
|
||||
let display = matches.value_of("display").unwrap_or("default.conf");
|
||||
|
@ -73,8 +72,8 @@ fn main() {
|
|||
println!("{:?}", path);
|
||||
panic!();
|
||||
}
|
||||
},
|
||||
Err(e) => println!("{:?}",e)
|
||||
}
|
||||
Err(e) => println!("{:?}", e),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,9 +88,7 @@ fn main() {
|
|||
new_state = "180";
|
||||
x_state = "normal";
|
||||
matrix = ["-1", "0", "1", "0", "-1", "1", "0", "0", "1"];
|
||||
}
|
||||
else {
|
||||
|
||||
} else {
|
||||
new_state = "90";
|
||||
x_state = "left";
|
||||
matrix = ["0", "-1", "1", "1", "0", "0", "0", "0", "1"];
|
||||
|
@ -101,8 +98,7 @@ fn main() {
|
|||
new_state = "180";
|
||||
x_state = "inverted";
|
||||
matrix = ["-1", "0", "1", "0", "-1", "1", "0", "0", "1"];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
new_state = "270";
|
||||
x_state = "right";
|
||||
matrix = ["0", "1", "0", "-1", "0", "1", "0", "0", "1"];
|
||||
|
@ -112,8 +108,7 @@ fn main() {
|
|||
new_state = "180";
|
||||
x_state = "inverted";
|
||||
matrix = ["-1", "0", "1", "0", "-1", "1", "0", "0", "1"];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
new_state = "normal";
|
||||
x_state = "normal";
|
||||
matrix = ["1", "0", "0", "0", "1", "0", "0", "0", "1"];
|
||||
|
@ -155,5 +150,3 @@ fn main() {
|
|||
thread::sleep(Duration::from_millis(sleep.parse::<u64>().unwrap_or(0)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue