From e61eb9b8467f92fab2a379cad4b7363844793201 Mon Sep 17 00:00:00 2001 From: itsjunetime Date: Thu, 6 Nov 2025 18:21:18 -0600 Subject: [PATCH] Fix r_to_l argument as well to just be a flag --- CHANGELOG.md | 1 + src/main.rs | 4 ++-- src/tui.rs | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64598d4..89162bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Unreleased - Switched simd base64 crate for one that works on stable (from `vb64` to `base64_simd`) +- Allow boolean arguments to function as flags, without a `true` or `false` argument following the flag itself # v0.4.3 diff --git a/src/main.rs b/src/main.rs index 0dce5e0..025101a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -83,7 +83,7 @@ async fn inner_main() -> Result<(), WrappedErr> { let flags = xflags::parse_or_exit! { /// Display the pdf with the pages starting at the right hand size and moving left and /// adjust input keys to match - optional -r,--r-to-l r_to_l: bool + optional -r,--r-to-l /// The maximum number of pages to display together, horizontally, at a time optional -m,--max-wide max_wide: NonZeroUsize /// Fullscreen the pdf (hide document name, page count, etc) @@ -270,7 +270,7 @@ async fn inner_main() -> Result<(), WrappedErr> { let tui = Tui::new( file_name, flags.max_wide, - flags.r_to_l.unwrap_or_default(), + flags.r_to_l, is_kitty ); diff --git a/src/tui.rs b/src/tui.rs index b08f950..e3ee62d 100644 --- a/src/tui.rs +++ b/src/tui.rs @@ -787,7 +787,7 @@ impl Tui { } } - // I want this to always return 0 'cause I just use it to return from `Self::handle_event`] + // I want this to always return an option 'cause I just use it to return from `Self::handle_event` #[expect(clippy::unnecessary_wraps)] fn update_zoom(&mut self, f: impl FnOnce(&mut Zoom)) -> Option { if let Some(z) = &mut self.zoom {