Skip to content

Commit deb1875

Browse files
committed
Tweak text and add test
1 parent b1482b0 commit deb1875

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

crates/turborepo-lib/src/cli/mod.rs

+17-1
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ pub enum Command {
587587
Boundaries {
588588
#[clap(short = 'F', long, group = "scope-filter-group")]
589589
filter: Vec<String>,
590-
#[clap(long, value_enum)]
590+
#[clap(long, value_enum, default_missing_value = "prompt", num_args = 0..=1)]
591591
ignore: Option<BoundariesIgnore>,
592592
#[clap(long, requires = "ignore")]
593593
reason: Option<String>,
@@ -3344,4 +3344,20 @@ mod test {
33443344
assert_snapshot!(args.join("-").as_str(), err);
33453345
}
33463346
}
3347+
3348+
#[test_case::test_case(&["turbo", "boundaries"], true; "empty")]
3349+
#[test_case::test_case(&["turbo", "boundaries", "--ignore"], true; "with ignore")]
3350+
#[test_case::test_case(&["turbo", "boundaries", "--ignore", "all"], true; "with ignore all")]
3351+
#[test_case::test_case(&["turbo", "boundaries", "--ignore", "prompt"], true; "with ignore prompt")]
3352+
#[test_case::test_case(&["turbo", "boundaries", "--filter", "ui"], true; "with filter")]
3353+
fn test_boundaries(args: &[&str], is_okay: bool) {
3354+
let os_args = args.iter().map(|s| OsString::from(*s)).collect();
3355+
let cli = Args::parse(os_args);
3356+
if is_okay {
3357+
cli.unwrap();
3358+
} else {
3359+
let err = cli.unwrap_err();
3360+
assert_snapshot!(args.join("-").as_str(), err);
3361+
}
3362+
}
33473363
}

crates/turborepo-lib/src/commands/boundaries.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@ pub async fn run(
3737
"automatically added by `turbo boundaries --ignore=all`".to_string()
3838
})),
3939
BoundariesIgnore::Prompt => {
40-
print!("\x1B[2J\x1B[1;1H");
40+
print!("{esc}c", esc = 27 as char);
41+
println!();
42+
println!();
4143
println!("{:?}", Report::new(diagnostic.clone()));
42-
let short_path = match run.repo_root().anchor(path) {
43-
Ok(path) => path.to_string(),
44-
Err(_) => path.to_string(),
45-
};
46-
let prompt = format!("Add @boundaries-ignore to {}?", short_path);
44+
let prompt = format!(
45+
"Ignore this error by adding a {} comment?",
46+
color!(run.color_config(), BOLD_GREEN, "@boundaries-ignore"),
47+
);
4748
if Confirm::new()
4849
.with_prompt(prompt)
4950
.default(false)

0 commit comments

Comments
 (0)