Skip to content

Commit

Permalink
Expose ignored option to CLI (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
maicki authored and amasad committed Sep 25, 2017
1 parent 480af5d commit 9f753a6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ Usage: sane <command> [...directory] [--glob=<filePattern>] [--poll] [--watchman
OPTIONS:
--glob=<filePattern>
A single string glob pattern or an array of them.
A single string glob pattern or an array of them.
--ignored=<filePattern>
A glob, regex, function, or array of any combination.
--poll, -p
Use polling mode.
Expand All @@ -107,9 +110,9 @@ OPTIONS:
Enables watching files/directories that start with a dot.
--wait=<seconds>
Duration, in seconds, that watching will be disabled
after running <command>. Setting this option will
throttle calls to <command> for the specified duration.
Duration, in seconds, that watching will be disabled
after running <command>. Setting this option will
throttle calls to <command> for the specified duration.
```

It will watch the given `directory` and run the given <command> every time a file changes.
Expand All @@ -118,6 +121,7 @@ It will watch the given `directory` and run the given <command> every time a fil
- `sane 'echo "A command ran"'`
- `sane 'echo "A command ran"' --glob='**/*.css'`
- `sane 'echo "A command ran"' site/assets/css --glob='**/*.css'`
- `sane 'echo "A command ran"' --glob='**/*.css' --ignored='**/ignore.css'`
- `sane 'echo "A command ran"' --wait=3`
- `sane 'echo "A command ran"' -p`

Expand Down
7 changes: 6 additions & 1 deletion src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ var execshell = require('exec-sh');
if (argv._.length === 0) {
var msg =
'Usage: sane <command> [...directory] [--glob=<filePattern>] ' +
'[--poll] [--watchman] [--dot] [--wait=<seconds>]';
'[--ignored=<filePattern>] [--poll] [--watchman] [--dot] ' +
'[--wait=<seconds>]';
console.error(msg);
process.exit();
}
Expand All @@ -19,6 +20,7 @@ var dir = argv._[1] || process.cwd();
var waitTime = Number(argv.wait || argv.w);
var dot = argv.dot || argv.d;
var glob = argv.glob || argv.g;
var ignored = argv.ignored || argv.i;
var poll = argv.poll || argv.p;
var watchman = argv.watchman || argv.w;

Expand All @@ -28,6 +30,9 @@ if (dot) {
if (glob) {
opts.glob = glob;
}
if (ignored) {
opts.ignored = ignored;
}
if (poll) {
opts.poll = true;
}
Expand Down

0 comments on commit 9f753a6

Please sign in to comment.