1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00

feat(task): log task script (#13922)

Logs task name and associated script with additional args.
This is disabled if "--quiet/-q" flag is present.
This commit is contained in:
Bartek Iwańczuk 2022-03-12 02:35:18 +01:00 committed by GitHub
parent 1a764790f2
commit 9d9e60b694
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 4 deletions

View file

@ -6,7 +6,7 @@ use crate::itest;
// These tests are intended to only test integration.
itest!(task_no_args {
args: "task --config task/deno.json",
args: "task -q --config task/deno.json",
output: "task/task_no_args.out",
envs: vec![("NO_COLOR".to_string(), "1".to_string())],
exit_code: 1,
@ -20,7 +20,7 @@ itest!(task_non_existent {
});
itest!(task_boolean_logic {
args: "task --config task/deno.json boolean_logic",
args: "task -q --config task/deno.json boolean_logic",
output: "task/task_boolean_logic.out",
envs: vec![("NO_COLOR".to_string(), "1".to_string())],
});
@ -33,13 +33,20 @@ itest!(task_exit_code_1 {
});
itest!(task_additional_args {
args: "task --config task/deno.json echo 2",
args: "task -q --config task/deno.json echo 2",
output: "task/task_additional_args.out",
envs: vec![("NO_COLOR".to_string(), "1".to_string())],
});
itest!(task_additional_args_no_shell_expansion {
args_vec: vec!["task", "--config", "task/deno.json", "echo", "$(echo 5)"],
args_vec: vec![
"task",
"-q",
"--config",
"task/deno.json",
"echo",
"$(echo 5)"
],
output: "task/task_additional_args_no_shell_expansion.out",
envs: vec![("NO_COLOR".to_string(), "1".to_string())],
});
@ -47,6 +54,7 @@ itest!(task_additional_args_no_shell_expansion {
itest!(task_additional_args_nested_strings {
args_vec: vec![
"task",
"-q",
"--config",
"task/deno.json",
"echo",
@ -59,6 +67,7 @@ itest!(task_additional_args_nested_strings {
itest!(task_additional_args_no_logic {
args_vec: vec![
"task",
"-q",
"--config",
"task/deno.json",
"echo",

View file

@ -1 +1,2 @@
Task exit_code_5 echo $(echo 10 ; exit 2) && exit 5
10

View file

@ -81,6 +81,12 @@ pub async fn execute_script(
.collect::<Vec<_>>()
.join(" ");
let script = format!("{} {}", script, additional_args);
log::info!(
"{} {} {}",
colors::green("Task"),
colors::cyan(&task_name),
script
);
let seq_list = deno_task_shell::parser::parse(&script)
.with_context(|| format!("Error parsing script '{}'.", task_name))?;
let env_vars = std::env::vars().collect::<HashMap<String, String>>();