Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var path = require('path')
var watch = require('./main.js')

if(argv._.length === 0) {
console.error('Usage: watch <command> [...directory] [--wait=<seconds>] [--filter=<file>] [--ignoreDotFiles] [--ignoreUnreadable]')
console.error('Usage: watch <command> [...directory] [--wait=<seconds>] [--filter=<file>] [--ignoreDotFiles] [--ignoreUnreadable] [--verbose]')
process.exit()
}

Expand Down Expand Up @@ -47,14 +47,26 @@ var dirLen = dirs.length
var skip = dirLen - 1
for(i = 0; i < dirLen; i++) {
var dir = dirs[i]
console.error('> Watching', dir)
console.error('> watch: Watching', dir)
watch.watchTree(dir, watchTreeOpts, function (f, curr, prev) {
if(skip) {
skip--
return
}
if(wait) return

if (argv.verbose || argv.v) {
if (typeof f == "object" && prev === null && curr === null) {
console.log("> watch: Watching " + Object.keys(f).length + " files.");
} else if (prev === null) {
console.log("> watch: New file: " + f + ". Executing.");
} else if (curr.nlink === 0) {
// f was removed
console.log("> watch: File removed: " + f + ". Executing.");
} else {
console.log("> watch: File changed: " + f + ". Executing");
}
}
execshell(command)

if(waitTime > 0) {
Expand Down