diff --git a/television/cli/args.rs b/television/cli/args.rs index a8e6a59..6d45370 100644 --- a/television/cli/args.rs +++ b/television/cli/args.rs @@ -463,11 +463,11 @@ pub struct Cli { /// space to meet the minimum height the terminal will scroll. #[arg( long, + default_value = "false", verbatim_doc_comment, - conflicts_with = "height", - value_parser = clap::builder::FalseyValueParser::new() + conflicts_with = "height" )] - pub inline: Option, + pub inline: bool, #[command(subcommand)] pub command: Option, diff --git a/television/cli/mod.rs b/television/cli/mod.rs index 29f6142..7d54724 100644 --- a/television/cli/mod.rs +++ b/television/cli/mod.rs @@ -88,7 +88,7 @@ pub struct PostProcessedCli { pub ui_scale: Option, pub height: Option, pub width: Option, - pub inline: Option, + pub inline: bool, // Behavior and matching configuration pub exact: bool, @@ -160,7 +160,7 @@ impl Default for PostProcessedCli { ui_scale: None, height: None, width: None, - inline: None, + inline: false, // Behavior and matching configuration exact: false, @@ -246,10 +246,7 @@ pub fn post_process(cli: Cli, readable_stdin: bool) -> PostProcessedCli { validate_adhoc_mode_constraints(&cli, readable_stdin); // Validate width flag requires inline or height - if cli.width.is_some() - && !cli.inline.unwrap_or(false) - && cli.height.is_none() - { + if cli.width.is_some() && !cli.inline && cli.height.is_none() { cli_parsing_error_exit( "--width can only be used in combination with --inline or --height", ); diff --git a/television/main.rs b/television/main.rs index 9eabf10..fdaea8c 100644 --- a/television/main.rs +++ b/television/main.rs @@ -99,7 +99,7 @@ async fn main() -> Result<()> { watch_interval, args.height, args.width, - args.inline.unwrap_or(false), + args.inline, ); let mut app = App::new( channel_prototype, @@ -142,9 +142,15 @@ fn apply_channel_overrides( args: &mut PostProcessedCli, channel_prototype: &ChannelPrototype, ) -> () { + // The default value for CLI args inline is `false`. If the CLI arguments have + // specified --inline, we should always take that value and ignore what the chanel wants + if args.inline { + return; + } if let Some(ui) = channel_prototype.ui.as_ref() { - if args.inline.is_none() { - args.inline = ui.inline; + // Otherwise, if the channel has specified an inline value, take it + if let Some(inline) = ui.inline { + args.inline = inline } } }