Commit f9122164 by PeterHatch Committed by Michael Mifsud

In watch mode, play an audible cue when there is an error. (#1578)

* In watch mode, play an audible cue when there is an error.

* Added error-bell option.

* Added error-bell option to documentation.
parent f2f481b5
...@@ -504,6 +504,7 @@ Example: ...@@ -504,6 +504,7 @@ Example:
--include-path Path to look for imported files --include-path Path to look for imported files
--follow Follow symlinked directories --follow Follow symlinked directories
--precision The amount of precision allowed in decimal numbers --precision The amount of precision allowed in decimal numbers
--error-bell Output a bell character on errors
--importer Path to .js file containing custom importer --importer Path to .js file containing custom importer
--functions Path to .js file containing custom functions --functions Path to .js file containing custom functions
--help Print usage info --help Print usage info
......
...@@ -53,14 +53,16 @@ var cli = meow({ ...@@ -53,14 +53,16 @@ var cli = meow({
' --include-path Path to look for imported files', ' --include-path Path to look for imported files',
' --follow Follow symlinked directories', ' --follow Follow symlinked directories',
' --precision The amount of precision allowed in decimal numbers', ' --precision The amount of precision allowed in decimal numbers',
' --error-bell Output a bell character on errors',
' --importer Path to .js file containing custom importer', ' --importer Path to .js file containing custom importer',
' --functions Path to .js file containing custom functions', ' --functions Path to .js file containing custom functions',
' --help Print usage info' ' --help Print usage info'
].join('\n') ].join('\n')
}, { }, {
boolean: [ boolean: [
'indented-syntax', 'error-bell',
'follow', 'follow',
'indented-syntax',
'omit-source-map-url', 'omit-source-map-url',
'quiet', 'quiet',
'recursive', 'recursive',
...@@ -143,6 +145,9 @@ function getEmitter() { ...@@ -143,6 +145,9 @@ function getEmitter() {
var emitter = new Emitter(); var emitter = new Emitter();
emitter.on('error', function(err) { emitter.on('error', function(err) {
if (options.errorBell) {
err += '\x07';
}
console.error(err); console.error(err);
if (!options.watch) { if (!options.watch) {
process.exit(1); process.exit(1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment