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.
|
/// space to meet the minimum height the terminal will scroll.
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
default_value = "false",
|
||||||
verbatim_doc_comment,
|
verbatim_doc_comment,
|
||||||
conflicts_with = "height",
|
conflicts_with = "height"
|
||||||
value_parser = clap::builder::FalseyValueParser::new()
|
|
||||||
)]
|
)]
|
||||||
pub inline: Option<bool>,
|
pub inline: bool,
|
||||||
|
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
pub command: Option<Command>,
|
pub command: Option<Command>,
|
||||||
|
@ -88,7 +88,7 @@ pub struct PostProcessedCli {
|
|||||||
pub ui_scale: Option<u16>,
|
pub ui_scale: Option<u16>,
|
||||||
pub height: Option<u16>,
|
pub height: Option<u16>,
|
||||||
pub width: Option<u16>,
|
pub width: Option<u16>,
|
||||||
pub inline: Option<bool>,
|
pub inline: bool,
|
||||||
|
|
||||||
// Behavior and matching configuration
|
// Behavior and matching configuration
|
||||||
pub exact: bool,
|
pub exact: bool,
|
||||||
@ -160,7 +160,7 @@ impl Default for PostProcessedCli {
|
|||||||
ui_scale: None,
|
ui_scale: None,
|
||||||
height: None,
|
height: None,
|
||||||
width: None,
|
width: None,
|
||||||
inline: None,
|
inline: false,
|
||||||
|
|
||||||
// Behavior and matching configuration
|
// Behavior and matching configuration
|
||||||
exact: false,
|
exact: false,
|
||||||
@ -246,10 +246,7 @@ pub fn post_process(cli: Cli, readable_stdin: bool) -> PostProcessedCli {
|
|||||||
validate_adhoc_mode_constraints(&cli, readable_stdin);
|
validate_adhoc_mode_constraints(&cli, readable_stdin);
|
||||||
|
|
||||||
// Validate width flag requires inline or height
|
// Validate width flag requires inline or height
|
||||||
if cli.width.is_some()
|
if cli.width.is_some() && !cli.inline && cli.height.is_none() {
|
||||||
&& !cli.inline.unwrap_or(false)
|
|
||||||
&& cli.height.is_none()
|
|
||||||
{
|
|
||||||
cli_parsing_error_exit(
|
cli_parsing_error_exit(
|
||||||
"--width can only be used in combination with --inline or --height",
|
"--width can only be used in combination with --inline or --height",
|
||||||
);
|
);
|
||||||
|
@ -99,7 +99,7 @@ async fn main() -> Result<()> {
|
|||||||
watch_interval,
|
watch_interval,
|
||||||
args.height,
|
args.height,
|
||||||
args.width,
|
args.width,
|
||||||
args.inline.unwrap_or(false),
|
args.inline,
|
||||||
);
|
);
|
||||||
let mut app = App::new(
|
let mut app = App::new(
|
||||||
channel_prototype,
|
channel_prototype,
|
||||||
@ -142,9 +142,15 @@ fn apply_channel_overrides(
|
|||||||
args: &mut PostProcessedCli,
|
args: &mut PostProcessedCli,
|
||||||
channel_prototype: &ChannelPrototype,
|
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 let Some(ui) = channel_prototype.ui.as_ref() {
|
||||||
if args.inline.is_none() {
|
// Otherwise, if the channel has specified an inline value, take it
|
||||||
args.inline = ui.inline;
|
if let Some(inline) = ui.inline {
|
||||||
|
args.inline = inline
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user