Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds CLI flag for controlling tui/stream #8714

Merged
merged 2 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions crates/turborepo-lib/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use crate::{
run::watch::WatchClient,
shim::TurboState,
tracing::TurboSubscriber,
turbo_json::UI as ConfigUI,
};

mod error;
Expand Down Expand Up @@ -183,6 +184,9 @@ pub struct Args {
/// Specify a file to save a pprof heap profile
#[clap(long, global = true, value_parser)]
pub heap: Option<String>,
/// Specify whether to use the streaming UI or TUI
#[clap(long, global = true, value_enum)]
pub ui: Option<ConfigUI>,
/// Override the login endpoint
#[clap(long, global = true, value_parser)]
pub login: Option<String>,
Expand Down
18 changes: 10 additions & 8 deletions crates/turborepo-lib/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,16 @@ 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
}
.with_ui(self.args.ui.map(|ui| ui.use_tui()).or_else(|| {
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
5 changes: 4 additions & 1 deletion crates/turborepo-lib/src/turbo_json/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::{

use biome_deserialize_macros::Deserializable;
use camino::Utf8Path;
use clap::ValueEnum;
use miette::{NamedSource, SourceSpan};
use serde::{Deserialize, Serialize};
use struct_iterable::Iterable;
Expand Down Expand Up @@ -159,10 +160,12 @@ impl DerefMut for Pipeline {
}
}

#[derive(Serialize, Debug, Copy, Clone, Deserializable, PartialEq, Eq)]
#[derive(Serialize, Debug, Copy, Clone, Deserializable, PartialEq, Eq, ValueEnum)]
#[serde(rename_all = "camelCase")]
pub enum UI {
/// Use the TUI interface
Tui,
/// Use the standard output stream
Stream,
}

Expand Down
Loading