diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-03-12 02:35:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-12 02:35:18 +0100 |
commit | 9d9e60b694888ffc20def928ffcd4da11da8be62 (patch) | |
tree | 98af8a152e2bd693d763b87645ddc454a9f67328 | |
parent | 1a764790f2b3622df5a1b20f0d05ff5f94c256b2 (diff) |
feat(task): log task script (#13922)
Logs task name and associated script with additional args.
This is disabled if "--quiet/-q" flag is present.
-rw-r--r-- | cli/tests/integration/task_tests.rs | 17 | ||||
-rw-r--r-- | cli/tests/testdata/task/task_exit_code_5.out | 1 | ||||
-rw-r--r-- | cli/tools/task.rs | 6 |
3 files changed, 20 insertions, 4 deletions
diff --git a/cli/tests/integration/task_tests.rs b/cli/tests/integration/task_tests.rs index 5d5887469..5ef5eaab2 100644 --- a/cli/tests/integration/task_tests.rs +++ b/cli/tests/integration/task_tests.rs @@ -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", diff --git a/cli/tests/testdata/task/task_exit_code_5.out b/cli/tests/testdata/task/task_exit_code_5.out index f599e28b8..fb5626d5b 100644 --- a/cli/tests/testdata/task/task_exit_code_5.out +++ b/cli/tests/testdata/task/task_exit_code_5.out @@ -1 +1,2 @@ +Task exit_code_5 echo $(echo 10 ; exit 2) && exit 5 10 diff --git a/cli/tools/task.rs b/cli/tools/task.rs index 0e863dbb8..3003bdfcc 100644 --- a/cli/tools/task.rs +++ b/cli/tools/task.rs @@ -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>>(); |