Skip to content

Commit 38da173

Browse files
Add --silent option
1 parent fa4b62a commit 38da173

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ Options:
105105
Effective when --polling is set [default: 300]
106106
--verbose When set, output is more verbose and human readable.
107107
[boolean] [default: false]
108+
--silent When set, internal messages of chokidar-cli won't be
109+
written. [boolean] [default: false]
108110
-h, --help Show help [boolean]
109111
-v, --version Show version number [boolean]
110112

index.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ var defaultOpts = {
2323
pollInterval: 100,
2424
pollIntervalBinary: 300,
2525
verbose: false,
26+
silent: false,
2627
initial: false,
2728
command: null
2829
};
@@ -102,6 +103,11 @@ var argv = require('yargs')
102103
default: defaultOpts.verbose,
103104
type: 'boolean'
104105
})
106+
.option('silent', {
107+
describe: 'When set, internal messages of chokidar-cli won\'t be written.',
108+
default: defaultOpts.silent,
109+
type: 'boolean'
110+
})
105111
.help('h')
106112
.alias('h', 'help')
107113
.alias('v', 'version')
@@ -132,7 +138,9 @@ function startWatching(opts) {
132138
if (opts.verbose) {
133139
console.error(description, path);
134140
} else {
135-
console.log(event + ':' + path);
141+
if (!opts.silent) {
142+
console.log(event + ':' + path);
143+
}
136144
}
137145

138146
// TODO: commands might be still run concurrently
@@ -148,7 +156,9 @@ function startWatching(opts) {
148156

149157
watcher.once('ready', function() {
150158
var list = opts.patterns.join('", "');
151-
console.error('Watching', '"' + list + '" ..');
159+
if (!opts.silent) {
160+
console.error('Watching', '"' + list + '" ..');
161+
}
152162
});
153163
}
154164

0 commit comments

Comments
 (0)