From 8d7cb63c7a95d46aa2508e9699929ef7165df1af Mon Sep 17 00:00:00 2001 From: Alex Clarke Date: Sun, 3 Nov 2024 15:33:08 -0700 Subject: [PATCH] Remove the terminal size checks since they've caused so many issues since their introduction --- README.md | 5 +---- src/main.rs | 29 +++-------------------------- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index aa1c1d7..b16364e 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,7 @@ To see all available commands, simply run `managarr --help`: ```shell $ managarr --help -managarr 0.1.3 +managarr 0.1.5 Alex Clarke A TUI and CLI to manage your Servarrs @@ -127,7 +127,6 @@ Commands: Options: --config The Managarr configuration file to use - --disable-terminal-size-checks Disable the terminal size checks -h, --help Print help -V, --version Print version ``` @@ -159,7 +158,6 @@ Commands: Options: --config The Managarr configuration file to use - --disable-terminal-size-checks Disable the terminal size checks -h, --help Print help ``` @@ -250,7 +248,6 @@ Managarr supports using environment variables on startup so you don't have to al | Variable | Description | Equivalent Flag | | --------------------------------------- | -------------------------------- | -------------------------------- | | `MANAGARR_CONFIG_FILE` | Set the path to the config file | `--config` | -| `MANAGARR_DISABLE_TERMINAL_SIZE_CHECKS` | Disable the terminal size checks | `--disable-terminal-size-checks` | ## Track My Progress for the Beta release (With Sonarr Support!) Progress for the beta release can be followed on my [Wekan Board](https://wekan.alexjclarke.com/b/dHoGjBb44MHM9HSv4/managarr) diff --git a/src/main.rs b/src/main.rs index 605da9d..b2922b3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,7 +18,7 @@ use clap_complete::generate; use colored::Colorize; use crossterm::execute; use crossterm::terminal::{ - disable_raw_mode, enable_raw_mode, size, EnterAlternateScreen, LeaveAlternateScreen, + disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen, }; use log::error; use network::NetworkTrait; @@ -46,9 +46,6 @@ mod network; mod ui; mod utils; -static MIN_TERM_WIDTH: u16 = 205; -static MIN_TERM_HEIGHT: u16 = 40; - #[derive(Debug, Parser)] #[command( name = crate_name!(), @@ -75,13 +72,6 @@ struct Cli { help = "The Managarr configuration file to use" )] config: Option, - #[arg( - long, - global = true, - env = "MANAGARR_DISABLE_TERMINAL_SIZE_CHECKS", - help = "Disable the terminal size checks" - )] - disable_terminal_size_checks: bool, } #[tokio::main] @@ -137,7 +127,7 @@ async fn main() -> Result<()> { std::thread::spawn(move || { start_networking(sync_network_rx, &app_nw, cancellation_token, reqwest_client) }); - start_ui(&app, !args.disable_terminal_size_checks).await?; + start_ui(&app).await?; } } @@ -160,20 +150,7 @@ async fn start_networking( } } -async fn start_ui(app: &Arc>>, check_terminal_size: bool) -> Result<()> { - if check_terminal_size { - let (width, height) = size()?; - if width < MIN_TERM_WIDTH || height < MIN_TERM_HEIGHT { - return Err(anyhow!( - "Terminal too small. Minimum size required: {}x{}; current terminal size: {}x{}", - MIN_TERM_WIDTH, - MIN_TERM_HEIGHT, - width, - height - )); - } - } - +async fn start_ui(app: &Arc>>) -> Result<()> { let mut stdout = io::stdout(); enable_raw_mode()?;