这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion crates/turborepo-lib/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ impl Display for LogOrder {
}
}

impl LogOrder {
pub fn compatible_with_tui(&self) -> bool {
// If the user requested a specific order to the logs, then this isn't
// compatible with the TUI and means we cannot use it.
matches!(self, Self::Auto)
}
}

#[derive(Copy, Clone, Debug, PartialEq, Serialize, ValueEnum)]
pub enum DryRunMode {
Text,
Expand Down Expand Up @@ -949,6 +957,7 @@ pub async fn run(
#[allow(unused_variables)] logger: &TurboSubscriber,
ui: UI,
) -> Result<i32, Error> {
// TODO: remove mutability from this function
let mut cli_args = Args::new();
let version = get_version();

Expand Down Expand Up @@ -979,7 +988,9 @@ pub async fn run(
let run_args = cli_args.run_args.take().unwrap_or_default();
let execution_args = cli_args
.execution_args
.take()
// We clone instead of take as take would leave the command base a copy of cli_args
// missing any execution args.
.clone()
.ok_or_else(|| Error::NoCommand(Backtrace::capture()))?;
if execution_args.tasks.is_empty() {
let mut cmd = <Args as CommandFactory>::command();
Expand Down Expand Up @@ -2554,4 +2565,11 @@ mod test {
);
assert!(Args::try_parse_from(["turbo", "build", "--preflight=true"]).is_err());
}

#[test]
fn test_log_stream_tui_compatibility() {
assert!(LogOrder::Auto.compatible_with_tui());
assert!(!LogOrder::Stream.compatible_with_tui());
assert!(!LogOrder::Grouped.compatible_with_tui());
}
}
9 changes: 9 additions & 0 deletions crates/turborepo-lib/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ impl CommandBase {
.with_token(self.args.token.clone())
.with_timeout(self.args.remote_cache_timeout)
.with_preflight(self.args.preflight.then_some(true))
.with_ui(self.args.execution_args.as_ref().and_then(|args| {
if !args.log_order.compatible_with_tui() {
Some(false)
} else {
// If the argument is compatible with the TUI this does not mean we should
// override other configs
None
}
}))
.build()
}

Expand Down