2023-07-21 19:15:26 +00:00
|
|
|
#![allow(dead_code)] // shared with other test modules
|
|
|
|
|
2022-10-22 15:27:04 +00:00
|
|
|
use clap::{builder::PossibleValue, Arg, ArgAction, Command, ValueHint};
|
2024-05-24 15:13:50 +00:00
|
|
|
use snapbox::prelude::*;
|
2022-10-22 15:27:04 +00:00
|
|
|
|
2024-05-04 19:59:40 +00:00
|
|
|
pub(crate) fn basic_command(name: &'static str) -> Command {
|
2022-10-22 15:27:04 +00:00
|
|
|
Command::new(name)
|
|
|
|
.arg(
|
|
|
|
Arg::new("config")
|
|
|
|
.short('c')
|
|
|
|
.global(true)
|
|
|
|
.action(ArgAction::SetTrue),
|
|
|
|
)
|
|
|
|
.arg(
|
|
|
|
Arg::new("v")
|
|
|
|
.short('v')
|
|
|
|
.conflicts_with("config")
|
|
|
|
.action(ArgAction::SetTrue),
|
|
|
|
)
|
|
|
|
.subcommand(
|
|
|
|
Command::new("test")
|
2024-02-16 22:16:36 +00:00
|
|
|
.about("Subcommand\nwith a second line")
|
2022-10-22 15:27:04 +00:00
|
|
|
.arg(Arg::new("debug").short('d').action(ArgAction::Count)),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2024-05-04 19:59:40 +00:00
|
|
|
pub(crate) fn feature_sample_command(name: &'static str) -> Command {
|
2022-10-22 15:27:04 +00:00
|
|
|
Command::new(name)
|
|
|
|
.version("3.0")
|
|
|
|
.propagate_version(true)
|
|
|
|
.about("Tests completions")
|
|
|
|
.arg(
|
|
|
|
Arg::new("file")
|
|
|
|
.value_hint(ValueHint::FilePath)
|
|
|
|
.help("some input file"),
|
|
|
|
)
|
|
|
|
.arg(
|
|
|
|
Arg::new("config")
|
|
|
|
.action(ArgAction::Count)
|
2024-02-16 22:16:36 +00:00
|
|
|
.help("some config file\nwith another line")
|
2022-10-22 15:27:04 +00:00
|
|
|
.short('c')
|
|
|
|
.visible_short_alias('C')
|
|
|
|
.long("config")
|
|
|
|
.visible_alias("conf"),
|
|
|
|
)
|
|
|
|
.arg(Arg::new("choice").value_parser(["first", "second"]))
|
|
|
|
.subcommand(
|
|
|
|
Command::new("test").about("tests things").arg(
|
|
|
|
Arg::new("case")
|
|
|
|
.long("case")
|
|
|
|
.action(ArgAction::Set)
|
|
|
|
.help("the case to test"),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2024-05-04 19:59:40 +00:00
|
|
|
pub(crate) fn special_commands_command(name: &'static str) -> Command {
|
2022-10-31 12:11:01 +00:00
|
|
|
feature_sample_command(name)
|
|
|
|
.subcommand(
|
2022-11-02 04:00:19 +00:00
|
|
|
Command::new("some_cmd")
|
2022-10-31 12:11:01 +00:00
|
|
|
.about("tests other things")
|
|
|
|
.arg(
|
2022-11-02 04:00:19 +00:00
|
|
|
Arg::new("config")
|
2022-10-31 12:11:01 +00:00
|
|
|
.long("config")
|
|
|
|
.hide(true)
|
2022-11-02 04:00:19 +00:00
|
|
|
.action(ArgAction::Set)
|
2022-10-31 12:11:01 +00:00
|
|
|
.require_equals(true)
|
|
|
|
.help("the other case to test"),
|
|
|
|
)
|
2022-11-02 04:00:19 +00:00
|
|
|
.arg(Arg::new("path").num_args(1..)),
|
|
|
|
)
|
|
|
|
.subcommand(Command::new("some-cmd-with-hyphens").alias("hyphen"))
|
|
|
|
.subcommand(Command::new("some-hidden-cmd").hide(true))
|
|
|
|
}
|
|
|
|
|
2024-05-04 19:59:40 +00:00
|
|
|
pub(crate) fn quoting_command(name: &'static str) -> Command {
|
2022-11-02 04:00:19 +00:00
|
|
|
Command::new(name)
|
|
|
|
.version("3.0")
|
|
|
|
.arg(
|
|
|
|
Arg::new("single-quotes")
|
|
|
|
.long("single-quotes")
|
|
|
|
.action(ArgAction::SetTrue)
|
|
|
|
.help("Can be 'always', 'auto', or 'never'"),
|
|
|
|
)
|
|
|
|
.arg(
|
|
|
|
Arg::new("double-quotes")
|
|
|
|
.long("double-quotes")
|
|
|
|
.action(ArgAction::SetTrue)
|
|
|
|
.help("Can be \"always\", \"auto\", or \"never\""),
|
|
|
|
)
|
|
|
|
.arg(
|
|
|
|
Arg::new("backticks")
|
|
|
|
.long("backticks")
|
|
|
|
.action(ArgAction::SetTrue)
|
|
|
|
.help("For more information see `echo test`"),
|
2022-10-31 12:11:01 +00:00
|
|
|
)
|
2022-11-02 04:00:19 +00:00
|
|
|
.arg(
|
|
|
|
Arg::new("backslash")
|
|
|
|
.long("backslash")
|
|
|
|
.action(ArgAction::SetTrue)
|
|
|
|
.help("Avoid '\\n'"),
|
|
|
|
)
|
|
|
|
.arg(
|
|
|
|
Arg::new("brackets")
|
|
|
|
.long("brackets")
|
|
|
|
.action(ArgAction::SetTrue)
|
|
|
|
.help("List packages [filter]"),
|
|
|
|
)
|
|
|
|
.arg(
|
|
|
|
Arg::new("expansions")
|
|
|
|
.long("expansions")
|
|
|
|
.action(ArgAction::SetTrue)
|
|
|
|
.help("Execute the shell command with $SHELL"),
|
|
|
|
)
|
|
|
|
.subcommands([
|
|
|
|
Command::new("cmd-single-quotes").about("Can be 'always', 'auto', or 'never'"),
|
|
|
|
Command::new("cmd-double-quotes").about("Can be \"always\", \"auto\", or \"never\""),
|
|
|
|
Command::new("cmd-backticks").about("For more information see `echo test`"),
|
|
|
|
Command::new("cmd-backslash").about("Avoid '\\n'"),
|
|
|
|
Command::new("cmd-brackets").about("List packages [filter]"),
|
|
|
|
Command::new("cmd-expansions").about("Execute the shell command with $SHELL"),
|
|
|
|
])
|
2022-10-31 12:11:01 +00:00
|
|
|
}
|
|
|
|
|
2024-05-04 19:59:40 +00:00
|
|
|
pub(crate) fn aliases_command(name: &'static str) -> Command {
|
2022-10-31 10:32:40 +00:00
|
|
|
Command::new(name)
|
|
|
|
.version("3.0")
|
|
|
|
.about("testing nushell completions")
|
|
|
|
.arg(
|
|
|
|
Arg::new("flag")
|
|
|
|
.short('f')
|
|
|
|
.visible_short_alias('F')
|
|
|
|
.long("flag")
|
|
|
|
.action(ArgAction::SetTrue)
|
|
|
|
.visible_alias("flg")
|
|
|
|
.help("cmd flag"),
|
|
|
|
)
|
|
|
|
.arg(
|
|
|
|
Arg::new("option")
|
|
|
|
.short('o')
|
|
|
|
.visible_short_alias('O')
|
|
|
|
.long("option")
|
|
|
|
.visible_alias("opt")
|
|
|
|
.help("cmd option")
|
|
|
|
.action(ArgAction::Set),
|
|
|
|
)
|
|
|
|
.arg(Arg::new("positional"))
|
|
|
|
}
|
|
|
|
|
2024-05-04 19:59:40 +00:00
|
|
|
pub(crate) fn sub_subcommands_command(name: &'static str) -> Command {
|
2022-10-22 15:27:04 +00:00
|
|
|
feature_sample_command(name).subcommand(
|
|
|
|
Command::new("some_cmd")
|
|
|
|
.about("top level subcommand")
|
2022-10-31 12:11:01 +00:00
|
|
|
.visible_alias("some_cmd_alias")
|
2022-10-22 15:27:04 +00:00
|
|
|
.subcommand(
|
|
|
|
Command::new("sub_cmd").about("sub-subcommand").arg(
|
|
|
|
Arg::new("config")
|
|
|
|
.long("config")
|
|
|
|
.action(ArgAction::Set)
|
2022-10-31 12:11:01 +00:00
|
|
|
.value_parser([
|
|
|
|
PossibleValue::new("Lest quotes, aren't escaped.")
|
|
|
|
.help("help,with,comma"),
|
|
|
|
PossibleValue::new("Second to trigger display of options"),
|
|
|
|
])
|
2022-10-22 15:27:04 +00:00
|
|
|
.help("the other case to test"),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2024-05-04 19:59:40 +00:00
|
|
|
pub(crate) fn value_hint_command(name: &'static str) -> Command {
|
2022-11-02 04:00:19 +00:00
|
|
|
Command::new(name)
|
2022-10-31 12:11:01 +00:00
|
|
|
.arg(
|
2022-11-02 04:00:19 +00:00
|
|
|
Arg::new("choice")
|
2022-10-31 12:11:01 +00:00
|
|
|
.long("choice")
|
2022-11-02 04:00:19 +00:00
|
|
|
.action(ArgAction::Set)
|
2022-10-31 12:11:01 +00:00
|
|
|
.value_parser(["bash", "fish", "zsh"]),
|
|
|
|
)
|
|
|
|
.arg(
|
2022-11-02 04:00:19 +00:00
|
|
|
Arg::new("unknown")
|
2022-10-31 12:11:01 +00:00
|
|
|
.long("unknown")
|
2022-11-02 04:00:19 +00:00
|
|
|
.value_hint(ValueHint::Unknown),
|
2022-10-31 12:11:01 +00:00
|
|
|
)
|
2022-11-02 04:00:19 +00:00
|
|
|
.arg(Arg::new("other").long("other").value_hint(ValueHint::Other))
|
2022-10-31 12:11:01 +00:00
|
|
|
.arg(
|
2022-11-02 04:00:19 +00:00
|
|
|
Arg::new("path")
|
2022-10-31 12:11:01 +00:00
|
|
|
.long("path")
|
|
|
|
.short('p')
|
2022-11-02 04:00:19 +00:00
|
|
|
.value_hint(ValueHint::AnyPath),
|
2022-10-31 12:11:01 +00:00
|
|
|
)
|
|
|
|
.arg(
|
2022-11-02 04:00:19 +00:00
|
|
|
Arg::new("file")
|
2022-10-31 12:11:01 +00:00
|
|
|
.long("file")
|
|
|
|
.short('f')
|
2022-11-02 04:00:19 +00:00
|
|
|
.value_hint(ValueHint::FilePath),
|
2022-10-31 12:11:01 +00:00
|
|
|
)
|
|
|
|
.arg(
|
2022-11-02 04:00:19 +00:00
|
|
|
Arg::new("dir")
|
2022-10-31 12:11:01 +00:00
|
|
|
.long("dir")
|
|
|
|
.short('d')
|
2022-11-02 04:00:19 +00:00
|
|
|
.value_hint(ValueHint::DirPath),
|
2022-10-31 12:11:01 +00:00
|
|
|
)
|
|
|
|
.arg(
|
2022-11-02 04:00:19 +00:00
|
|
|
Arg::new("exe")
|
2022-10-31 12:11:01 +00:00
|
|
|
.long("exe")
|
|
|
|
.short('e')
|
2022-11-02 04:00:19 +00:00
|
|
|
.value_hint(ValueHint::ExecutablePath),
|
2022-10-31 12:11:01 +00:00
|
|
|
)
|
|
|
|
.arg(
|
2022-11-02 04:00:19 +00:00
|
|
|
Arg::new("cmd_name")
|
2022-10-31 12:11:01 +00:00
|
|
|
.long("cmd-name")
|
2022-11-02 04:00:19 +00:00
|
|
|
.value_hint(ValueHint::CommandName),
|
2022-10-31 12:11:01 +00:00
|
|
|
)
|
|
|
|
.arg(
|
2022-11-02 04:00:19 +00:00
|
|
|
Arg::new("cmd")
|
2022-10-31 12:11:01 +00:00
|
|
|
.long("cmd")
|
|
|
|
.short('c')
|
2022-11-02 04:00:19 +00:00
|
|
|
.value_hint(ValueHint::CommandString),
|
2022-10-31 12:11:01 +00:00
|
|
|
)
|
|
|
|
.arg(
|
2022-11-02 04:00:19 +00:00
|
|
|
Arg::new("command_with_args")
|
|
|
|
.action(ArgAction::Set)
|
2022-10-31 12:11:01 +00:00
|
|
|
.num_args(1..)
|
|
|
|
.trailing_var_arg(true)
|
2022-11-02 04:00:19 +00:00
|
|
|
.value_hint(ValueHint::CommandWithArguments),
|
2022-10-31 12:11:01 +00:00
|
|
|
)
|
|
|
|
.arg(
|
2022-11-02 04:00:19 +00:00
|
|
|
Arg::new("user")
|
2022-10-31 12:11:01 +00:00
|
|
|
.short('u')
|
|
|
|
.long("user")
|
2022-11-02 04:00:19 +00:00
|
|
|
.value_hint(ValueHint::Username),
|
2022-10-31 12:11:01 +00:00
|
|
|
)
|
|
|
|
.arg(
|
2022-11-02 04:00:19 +00:00
|
|
|
Arg::new("host")
|
2022-10-31 12:11:01 +00:00
|
|
|
.short('H')
|
|
|
|
.long("host")
|
2022-11-02 04:00:19 +00:00
|
|
|
.value_hint(ValueHint::Hostname),
|
2022-10-31 12:11:01 +00:00
|
|
|
)
|
2022-11-02 04:00:19 +00:00
|
|
|
.arg(Arg::new("url").long("url").value_hint(ValueHint::Url))
|
2022-10-31 12:11:01 +00:00
|
|
|
.arg(
|
2022-11-02 04:00:19 +00:00
|
|
|
Arg::new("email")
|
2022-10-31 12:11:01 +00:00
|
|
|
.long("email")
|
2022-11-02 04:00:19 +00:00
|
|
|
.value_hint(ValueHint::EmailAddress),
|
2022-10-31 12:11:01 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2024-05-04 19:59:40 +00:00
|
|
|
pub(crate) fn assert_matches(
|
2024-05-24 15:13:50 +00:00
|
|
|
expected: impl IntoData,
|
2022-10-22 15:27:04 +00:00
|
|
|
gen: impl clap_complete::Generator,
|
2024-05-04 19:59:40 +00:00
|
|
|
mut cmd: Command,
|
2022-10-22 15:27:04 +00:00
|
|
|
name: &'static str,
|
|
|
|
) {
|
|
|
|
let mut buf = vec![];
|
|
|
|
clap_complete::generate(gen, &mut cmd, name, &mut buf);
|
|
|
|
|
|
|
|
snapbox::Assert::new()
|
2024-05-24 15:13:50 +00:00
|
|
|
.action_env(snapbox::assert::DEFAULT_ACTION_ENV)
|
2022-10-31 12:11:01 +00:00
|
|
|
.normalize_paths(false)
|
2024-05-24 15:13:50 +00:00
|
|
|
.eq(buf, expected);
|
2022-10-22 15:27:04 +00:00
|
|
|
}
|
2023-07-21 19:15:26 +00:00
|
|
|
|
2024-05-04 19:59:40 +00:00
|
|
|
pub(crate) fn register_example<R: completest::RuntimeBuilder>(context: &str, name: &str) {
|
2024-01-15 18:20:57 +00:00
|
|
|
use completest::Runtime as _;
|
|
|
|
|
2024-05-24 15:13:50 +00:00
|
|
|
let scratch = snapbox::dir::DirRoot::mutable_temp().unwrap();
|
2023-07-21 19:15:26 +00:00
|
|
|
let scratch_path = scratch.path().unwrap();
|
|
|
|
|
2024-01-15 18:20:57 +00:00
|
|
|
let shell_name = R::name();
|
2023-07-21 19:15:26 +00:00
|
|
|
let home = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
|
|
|
|
.join("tests/snapshots/home")
|
2024-01-15 18:20:57 +00:00
|
|
|
.join(context)
|
2023-07-21 19:15:26 +00:00
|
|
|
.join(name)
|
|
|
|
.join(shell_name);
|
|
|
|
println!("Compiling");
|
|
|
|
let manifest_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("Cargo.toml");
|
|
|
|
let bin_path =
|
|
|
|
snapbox::cmd::compile_example(name, ["--manifest-path", manifest_path.to_str().unwrap()])
|
|
|
|
.unwrap();
|
|
|
|
println!("Compiled");
|
|
|
|
let bin_root = bin_path.parent().unwrap().to_owned();
|
|
|
|
|
2024-01-15 18:20:57 +00:00
|
|
|
let mut registration = std::process::Command::new(&bin_path);
|
|
|
|
match context {
|
|
|
|
"static" => registration.args([format!("--generate={shell_name}")]),
|
|
|
|
"dynamic" => registration.args([
|
|
|
|
"complete".to_owned(),
|
|
|
|
"--register=-".to_owned(),
|
|
|
|
format!("--shell={shell_name}"),
|
|
|
|
]),
|
|
|
|
_ => unreachable!("unsupported context {}", context),
|
|
|
|
};
|
|
|
|
let registration = registration.output().unwrap();
|
2023-07-21 19:15:26 +00:00
|
|
|
assert!(
|
|
|
|
registration.status.success(),
|
|
|
|
"{}",
|
|
|
|
String::from_utf8_lossy(®istration.stderr)
|
|
|
|
);
|
|
|
|
let registration = std::str::from_utf8(®istration.stdout).unwrap();
|
|
|
|
assert!(!registration.is_empty());
|
|
|
|
|
2024-01-15 18:20:57 +00:00
|
|
|
let mut runtime = R::new(bin_root, scratch_path.to_owned()).unwrap();
|
2023-07-21 19:15:26 +00:00
|
|
|
|
|
|
|
runtime.register(name, registration).unwrap();
|
|
|
|
|
|
|
|
snapbox::assert_subset_eq(home, scratch_path);
|
|
|
|
|
|
|
|
scratch.close().unwrap();
|
|
|
|
}
|
|
|
|
|
2024-05-04 19:59:40 +00:00
|
|
|
pub(crate) fn load_runtime<R: completest::RuntimeBuilder>(
|
2024-01-15 18:20:57 +00:00
|
|
|
context: &str,
|
|
|
|
name: &str,
|
|
|
|
) -> Box<dyn completest::Runtime>
|
|
|
|
where
|
|
|
|
<R as completest::RuntimeBuilder>::Runtime: 'static,
|
|
|
|
{
|
|
|
|
let shell_name = R::name();
|
2023-07-21 19:15:26 +00:00
|
|
|
let home = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
|
|
|
|
.join("tests/snapshots/home")
|
2024-01-15 18:20:57 +00:00
|
|
|
.join(context)
|
2023-07-21 19:15:26 +00:00
|
|
|
.join(name)
|
|
|
|
.join(shell_name);
|
2024-05-24 15:13:50 +00:00
|
|
|
let scratch = snapbox::dir::DirRoot::mutable_temp()
|
2024-01-15 18:20:57 +00:00
|
|
|
.unwrap()
|
|
|
|
.with_template(&home)
|
|
|
|
.unwrap();
|
2023-07-21 19:15:26 +00:00
|
|
|
let home = scratch.path().unwrap().to_owned();
|
|
|
|
println!("Compiling");
|
|
|
|
let manifest_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("Cargo.toml");
|
|
|
|
let bin_path =
|
|
|
|
snapbox::cmd::compile_example(name, ["--manifest-path", manifest_path.to_str().unwrap()])
|
|
|
|
.unwrap();
|
|
|
|
println!("Compiled");
|
|
|
|
let bin_root = bin_path.parent().unwrap().to_owned();
|
|
|
|
|
2024-01-15 18:20:57 +00:00
|
|
|
let runtime = R::with_home(bin_root, home).unwrap();
|
2023-07-21 19:15:26 +00:00
|
|
|
|
|
|
|
Box::new(ScratchRuntime {
|
|
|
|
_scratch: scratch,
|
2024-01-15 18:20:57 +00:00
|
|
|
runtime: Box::new(runtime),
|
2023-07-21 19:15:26 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
struct ScratchRuntime {
|
2024-05-24 15:13:50 +00:00
|
|
|
_scratch: snapbox::dir::DirRoot,
|
2023-07-21 19:15:26 +00:00
|
|
|
runtime: Box<dyn completest::Runtime>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl completest::Runtime for ScratchRuntime {
|
|
|
|
fn home(&self) -> &std::path::Path {
|
|
|
|
self.runtime.home()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn register(&mut self, name: &str, content: &str) -> std::io::Result<()> {
|
|
|
|
self.runtime.register(name, content)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn complete(&mut self, input: &str, term: &completest::Term) -> std::io::Result<String> {
|
|
|
|
let output = self.runtime.complete(input, term)?;
|
|
|
|
// HACK: elvish prints and clears this message when a completer takes too long which is
|
|
|
|
// dependent on a lot of factors, making this show up or no sometimes (especially if we
|
|
|
|
// aren't clearing the screen properly for fish)
|
|
|
|
let output = output.replace("\nCOMPLETING argument\n", "\n");
|
|
|
|
Ok(output)
|
|
|
|
}
|
|
|
|
}
|
2024-01-15 18:20:57 +00:00
|
|
|
|
2024-05-04 19:59:40 +00:00
|
|
|
pub(crate) fn has_command(command: &str) -> bool {
|
2024-01-15 18:20:57 +00:00
|
|
|
let output = match std::process::Command::new(command)
|
|
|
|
.arg("--version")
|
|
|
|
.output()
|
|
|
|
{
|
|
|
|
Ok(output) => output,
|
|
|
|
Err(e) => {
|
|
|
|
// CI is expected to support all of the commands
|
2024-06-25 18:18:15 +00:00
|
|
|
if is_ci() && cfg!(target_os = "linux") {
|
2024-01-15 18:20:57 +00:00
|
|
|
panic!(
|
|
|
|
"expected command `{}` to be somewhere in PATH: {}",
|
|
|
|
command, e
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
if !output.status.success() {
|
|
|
|
panic!(
|
|
|
|
"expected command `{}` to be runnable, got error {}:\n\
|
|
|
|
stderr:{}\n\
|
|
|
|
stdout:{}\n",
|
|
|
|
command,
|
|
|
|
output.status,
|
|
|
|
String::from_utf8_lossy(&output.stderr),
|
|
|
|
String::from_utf8_lossy(&output.stdout)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
let stdout = String::from_utf8_lossy(&output.stdout);
|
|
|
|
println!(
|
|
|
|
"$ {command} --version
|
|
|
|
{}",
|
|
|
|
stdout
|
|
|
|
);
|
|
|
|
if cfg!(target_os = "macos") && stdout.starts_with("GNU bash, version 3") {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if cfg!(target_os = "macos") && command == "zsh" {
|
|
|
|
// HACK: At least on CI, the prompt override is not working
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
true
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Whether or not this running in a Continuous Integration environment.
|
|
|
|
fn is_ci() -> bool {
|
|
|
|
// Consider using `tracked_env` instead of option_env! when it is stabilized.
|
|
|
|
// `tracked_env` will handle changes, but not require rebuilding the macro
|
|
|
|
// itself like option_env does.
|
|
|
|
option_env!("CI").is_some() || option_env!("TF_BUILD").is_some()
|
|
|
|
}
|