refactor: dead code removed, methods renamed

This commit is contained in:
Jack Wills
2024-11-18 10:28:27 +00:00
parent 7f42383495
commit ba6a952413
3 changed files with 3 additions and 12 deletions
+1 -5
View File
@@ -2,15 +2,13 @@ use crate::app_data::DockerCommand;
use std::fmt; use std::fmt;
/// app errors to set in global state /// app errors to set in global state
#[allow(unused)] // #[allow(unused)]
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub enum AppError { pub enum AppError {
DockerCommand(DockerCommand), DockerCommand(DockerCommand),
DockerExec, DockerExec,
DockerLogs, DockerLogs,
DockerConnect, DockerConnect,
DockerInterval,
InputPoll,
MouseCapture(bool), MouseCapture(bool),
Terminal, Terminal,
} }
@@ -23,8 +21,6 @@ impl fmt::Display for AppError {
Self::DockerExec => write!(f, "Unable to exec into container"), Self::DockerExec => write!(f, "Unable to exec into container"),
Self::DockerLogs => write!(f, "Unable to save logs"), Self::DockerLogs => write!(f, "Unable to save logs"),
Self::DockerConnect => write!(f, "Unable to access docker daemon"), Self::DockerConnect => write!(f, "Unable to access docker daemon"),
Self::DockerInterval => write!(f, "Docker update interval needs to be greater than 0"),
Self::InputPoll => write!(f, "Unable to poll user input"),
Self::MouseCapture(x) => { Self::MouseCapture(x) => {
let reason = if *x { "en" } else { "dis" }; let reason = if *x { "en" } else { "dis" };
write!(f, "Unable to {reason}able mouse capture") write!(f, "Unable to {reason}able mouse capture")
+1 -6
View File
@@ -65,12 +65,7 @@ impl CliArgs {
/// An ENV is set in the ./containerised/Dockerfile, if this is ENV found, then sleep for 250ms, else the container, for as yet unknown reasons, will close immediately /// An ENV is set in the ./containerised/Dockerfile, if this is ENV found, then sleep for 250ms, else the container, for as yet unknown reasons, will close immediately
/// returns a bool, so that the `update_all_containers()` won't bother to check the entry point unless running via a container /// returns a bool, so that the `update_all_containers()` won't bother to check the entry point unless running via a container
fn check_if_in_container() -> bool { fn check_if_in_container() -> bool {
if let Ok(value) = std::env::var(ENV_KEY) { std::env::var(ENV_KEY).map_or(false, |i| i == ENV_VALUE)
if value == ENV_VALUE {
return true;
}
}
false
} }
/// Parse cli arguments /// Parse cli arguments
+1 -1
View File
@@ -59,7 +59,7 @@ impl Ui {
} }
/// Create a new Ui struct, and execute the drawing loop /// Create a new Ui struct, and execute the drawing loop
pub async fn create( pub async fn start(
app_data: Arc<Mutex<AppData>>, app_data: Arc<Mutex<AppData>>,
gui_state: Arc<Mutex<GuiState>>, gui_state: Arc<Mutex<GuiState>>,
input_tx: Sender<InputMessages>, input_tx: Sender<InputMessages>,