Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Docs for quiet-flag

  • Loading branch information...
commit 7f93f2f8082550e8f9745fc7409891f5ddd6a1a7 1 parent 23c045d
mde authored
Showing with 42 additions and 13 deletions.
  1. +33 −4 README.md
  2. +9 −9 lib/program.js
View
37 README.md
@@ -63,10 +63,10 @@ Add the directory of node.exe to the environment PATH variable.
### Options
-V/v
- --version Display the program version.
+ --version Display the Jake version.
-h
- --help Display help information.
+ --help Display help message.
-f *FILE*
--jakefile *FILE* Use FILE as the Jakefile.
@@ -74,6 +74,9 @@ Add the directory of node.exe to the environment PATH variable.
-C *DIRECTORY*
--directory *DIRECTORY* Change to DIRECTORY before running tasks.
+ -q
+ --quiet Do not log messages to standard output.
+
-J *JAKELIBDIR*
--jakelibdir *JAKELIBDIR* Auto-import any .jake files in JAKELIBDIR.
(default is 'jakelib')
@@ -82,10 +85,11 @@ Add the directory of node.exe to the environment PATH variable.
--always-make Unconditionally make all targets.
-t
- --trace Enable full backtracke.
+ --trace Enable full backtrace.
-T
- --tasks Display the tasks, with descriptions, then exit.
+ --tasks Display the tasks (matching optional PATTERN)
+ with descriptions, then exit.
### Jakefile syntax
@@ -615,6 +619,31 @@ Using the evented Exec object gives you a lot more flexibility in running shell
commmands. But if you need something more sophisticated, Procstreams
(<https://github.com/polotek/procstreams>) might be a good option.
+## Logging and output
+
+Using the -q/--quiet flag at the command-line will stop Jake from sending its
+normal output to standard output. Note that this only applies to built-in output
+from Jake; anything you output normally from your tasks will still be displayed.
+
+If you want to take advantage of the -q/--quiet flag in your own programs, you
+can use `jake.logger.log` and `jake.logger.error` for displaying output. These
+two commands will respect the flag, and suppress output correctly when the
+quiet-flag is on.
+
+You can check the current value of this flag in your own tasks by using
+`jake.program.opts.quiet`. If you want the output of a `jake.exec` shell-command
+to respect the quiet-flag, set your `printStdout` and `printStderr` options to
+false if the quiet-option is on:
+
+```javascript
+task('echo', function () {
+ jake.exec(['echo "hello"'], function () {
+ jake.logger.log('Done.');
+ complete();
+ }, {printStdout: !jake.program.opts.quiet});
+}, {async: true});
+```
+
## PackageTask
Instantiating a PackageTask programmically creates a set of tasks for packaging
View
18 lib/program.js
@@ -90,15 +90,15 @@ usage = ''
+ '{Usage}: jake [options ...] [env variables ...] target\n'
+ '\n'
+ '{Options}:\n'
- + ' -f, --jakefile FILE Use FILE as the Jakefile.\n'
- + ' -C, --directory DIRECTORY Change to DIRECTORY before running tasks.\n'
- + ' -q, --quiet Do not log messages to standard output.\n'
- + ' -B, --always-make Unconditionally make all targets.\n'
- + ' -T, --tasks Display the tasks (matching optional PATTERN) with descriptions, then exit.\n'
- + ' -J, --jakelibdir JAKELIBDIR Auto-import any .jake files in JAKELIBDIR. (default is \'jakelib\')\n'
- + ' -t, --trace Enable full backtrace.\n'
- + ' -h, --help Display this help message.\n'
- + ' -V, --version Display the Jake version.\n'
+ + ' -f, --jakefile FILE Use FILE as the Jakefile.\n'
+ + ' -C, --directory DIRECTORY Change to DIRECTORY before running tasks.\n'
+ + ' -q, --quiet Do not log messages to standard output.\n'
+ + ' -B, --always-make Unconditionally make all targets.\n'
+ + ' -T, --tasks Display the tasks (matching optional PATTERN) with descriptions, then exit.\n'
+ + ' -J, --jakelibdir JAKELIBDIR Auto-import any .jake files in JAKELIBDIR. (default is \'jakelib\')\n'
+ + ' -t, --trace Enable full backtrace.\n'
+ + ' -h, --help Display this help message.\n'
+ + ' -V/v, --version Display the Jake version.\n'
+ '';
Program = function () {
Please sign in to comment.
Something went wrong with that request. Please try again.