mirror of
https://github.com/alexpasmantier/television.git
synced 2025-07-29 06:11:37 +00:00
back out option
This commit is contained in:
parent
6195f2321b
commit
339c374127
@ -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<bool>,
|
||||
pub inline: bool,
|
||||
|
||||
#[command(subcommand)]
|
||||
pub command: Option<Command>,
|
||||
|
@ -88,7 +88,7 @@ pub struct PostProcessedCli {
|
||||
pub ui_scale: Option<u16>,
|
||||
pub height: Option<u16>,
|
||||
pub width: Option<u16>,
|
||||
pub inline: Option<bool>,
|
||||
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",
|
||||
);
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user