mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-04-21 17:03:20 +03:00
remove unused code
This commit is contained in:
@@ -1,48 +0,0 @@
|
|||||||
use std::io::{self, Write};
|
|
||||||
|
|
||||||
use crate::client::Position;
|
|
||||||
|
|
||||||
pub fn ask_confirmation(default: bool) -> Result<bool, io::Error> {
|
|
||||||
eprint!("{}", if default { " [Y,n] " } else { " [y,N] " });
|
|
||||||
io::stderr().flush()?;
|
|
||||||
let answer = loop {
|
|
||||||
let mut buffer = String::new();
|
|
||||||
io::stdin().read_line(&mut buffer)?;
|
|
||||||
let answer = buffer.to_lowercase();
|
|
||||||
let answer = answer.trim();
|
|
||||||
match answer {
|
|
||||||
"" => break default,
|
|
||||||
"y" => break true,
|
|
||||||
"n" => break false,
|
|
||||||
_ => {
|
|
||||||
eprint!("Enter y for Yes or n for No: ");
|
|
||||||
io::stderr().flush()?;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Ok(answer)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn ask_position() -> Result<Position, io::Error> {
|
|
||||||
eprint!("Enter position - top (t) | bottom (b) | left(l) | right(r): ");
|
|
||||||
io::stderr().flush()?;
|
|
||||||
let pos = loop {
|
|
||||||
let mut buffer = String::new();
|
|
||||||
io::stdin().read_line(&mut buffer)?;
|
|
||||||
let answer = buffer.to_lowercase();
|
|
||||||
let answer = answer.trim();
|
|
||||||
match answer {
|
|
||||||
"t" | "top" => break Position::Top,
|
|
||||||
"b" | "bottom" => break Position::Bottom,
|
|
||||||
"l" | "left" => break Position::Right,
|
|
||||||
"r" | "right" => break Position::Left,
|
|
||||||
_ => {
|
|
||||||
eprint!("Invalid position: {answer} - enter top (t) | bottom (b) | left(l) | right(r): ");
|
|
||||||
io::stderr().flush()?;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
Ok(pos)
|
|
||||||
}
|
|
||||||
@@ -9,5 +9,4 @@ pub mod producer;
|
|||||||
|
|
||||||
pub mod backend;
|
pub mod backend;
|
||||||
pub mod frontend;
|
pub mod frontend;
|
||||||
pub mod ioutils;
|
|
||||||
pub mod scancode;
|
pub mod scancode;
|
||||||
|
|||||||
Reference in New Issue
Block a user