diff options
Diffstat (limited to 'tests/test/script/runner/driver.cxx')
-rw-r--r-- | tests/test/script/runner/driver.cxx | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/tests/test/script/runner/driver.cxx b/tests/test/script/runner/driver.cxx index 08d5bba..d5a74a4 100644 --- a/tests/test/script/runner/driver.cxx +++ b/tests/test/script/runner/driver.cxx @@ -34,22 +34,22 @@ main (int argc, char* argv[]) using butl::optional; // Usage: driver [-i <int>] (-o <string>)* (-e <string>)* (-f <file>)* - // (-d <dir>)* [(-t (a|m|s|z)) | (-s <int>)] + // (-d <dir>)* (-v <name>)* [(-t (a|m|s|z)) | (-s <int>)] // - // Execute actions specified by -i, -o, -e, -f, -d options in the order as - // they appear on the command line. After that terminate abnormally if -t - // option is provided, otherwise exit normally with the status specified by - // -s option (0 by default). + // Execute actions specified by -i, -o, -e, -f, -d, and -v options in the + // order as they appear on the command line. After that terminate abnormally + // if -t option is provided, otherwise exit normally with the status + // specified by -s option (0 by default). // // -i <fd> - // Forward STDIN data to the standard stream denoted by the file + // Forward stdin data to the standard stream denoted by the file // descriptor. Read and discard if 0. // // -o <string> - // Print the line to STDOUT. + // Print the line to stdout. // // -e <string> - // Print the line to STDERR. + // Print the line to stderr. // // -f <path> // Create an empty file with the path specified. @@ -58,6 +58,10 @@ main (int argc, char* argv[]) // Create a directory with the path specified. Create parent directories // if required. // + // -v <name> + // If the specified variable is set the print its value to stdout and the + // string '<none>' otherwise. + // // -t <method> // Abnormally terminate itself using one of the following methods: // @@ -135,6 +139,11 @@ main (int argc, char* argv[]) { try_mkdir_p (dir_path (v)); } + else if (o == "-v") + { + optional<string> var (getenv (v)); + cout << (var ? *var : "<none>") << endl; + } else if (o == "-t") { assert (aterm == '\0' && !status); // Make sure exit method is not set. |