From 7683c81c089e626fdd6aca02dac8182a7e29d149 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Sat, 29 Jun 2024 18:12:31 -0700 Subject: [PATCH] Allow unstable features with `--summary` (#2210) --- src/config.rs | 7 ++++++- tests/summary.rs | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index 0e8f3d4..c32d62b 100644 --- a/src/config.rs +++ b/src/config.rs @@ -744,6 +744,8 @@ impl Config { } }; + let unstable = matches.get_flag(arg::UNSTABLE) || subcommand == Subcommand::Summary; + Ok(Self { check: matches.get_flag(arg::CHECK), color: Self::color_from_matches(matches)?, @@ -783,7 +785,7 @@ impl Config { .unwrap() .into(), unsorted: matches.get_flag(arg::UNSORTED), - unstable: matches.get_flag(arg::UNSTABLE), + unstable, verbosity: if matches.get_flag(arg::QUIET) { Verbosity::Quiet } else { @@ -834,6 +836,7 @@ mod tests { $(shell_args: $shell_args:expr,)? $(subcommand: $subcommand:expr,)? $(unsorted: $unsorted:expr,)? + $(unstable: $unstable:expr,)? $(verbosity: $verbosity:expr,)? } => { #[test] @@ -854,6 +857,7 @@ mod tests { $(shell_args: $shell_args,)? $(subcommand: $subcommand,)? $(unsorted: $unsorted,)? + $(unstable: $unstable,)? $(verbosity: $verbosity,)? ..testing::config(&[]) }; @@ -1368,6 +1372,7 @@ mod tests { name: subcommand_summary, args: ["--summary"], subcommand: Subcommand::Summary, + unstable: true, } test! { diff --git a/tests/summary.rs b/tests/summary.rs index ee27ca0..7b70baa 100644 --- a/tests/summary.rs +++ b/tests/summary.rs @@ -71,3 +71,18 @@ fn submodule_recipes() { .stdout("bar foo::foo foo::bar::bar foo::bar::baz::baz foo::bar::baz::biz::biz\n") .run(); } + +#[test] +fn summary_implies_unstable() { + Test::new() + .write("foo.just", "foo:") + .justfile( + " + mod foo + ", + ) + .test_round_trip(false) + .arg("--summary") + .stdout("foo::foo\n") + .run(); +}