Browse Source

add --start option

pull/2/head
Brett Langdon 12 years ago
parent
commit
afc4123adc
2 changed files with 9 additions and 1 deletions
  1. +3
    -1
      bin/tend
  2. +6
    -0
      lib/index.js

+ 3
- 1
bin/tend View File

@ -7,13 +7,14 @@ var doc = [
'Usage:',
' tend',
' tend (--help | --version)',
' tend [--restart] [--ignoreHidden] [<dir> <command>] [<filter>]',
' tend [--restart] [--start] [--ignoreHidden] [<dir> <command>] [<filter>]',
'',
'Options:',
' -h --help Show this help text',
' -v --version Show tend version information',
' -r --restart If <command> is still running when there is a change, stop and re-run it',
' -i --ignoreHidden Ignore changes to files which start with "."',
' -s --start Run <command> as soon as tend executes',
].join('\r\n');
var args = docopt.docopt(doc, {
@ -36,6 +37,7 @@ if (args['<dir>'] && args['<command>']) {
filter: args['<filter>'],
ignoreHidden: args['--ignoreHidden'],
restart: args['--restart'],
start: args['--start'],
command: args['<command>'],
directory: args['<dir>'],
}


+ 6
- 0
lib/index.js View File

@ -75,6 +75,10 @@ module.exports.tend = function(dir, rawCommand, options) {
clearTimeout(timeout);
timeout = setTimeout(startCommand, 300);
});
if(options.start){
startCommand();
}
};
module.exports.parseConfig = function() {
@ -85,6 +89,7 @@ module.exports.parseConfig = function() {
filter: rawConfig.filter || '.',
ignoreHidden: (rawConfig.ignoreHidden === undefined) ? false : rawConfig.ignoreHidden,
restart: (rawConfig.restart === undefined) ? false : rawConfig.restart,
start: (rawConfig.start === undefined) ? false : rawConfig.start,
};
for (var key in rawConfig) {
@ -103,6 +108,7 @@ module.exports.parseConfig = function() {
filter: (section.filter === undefined) ? defaults.filter : section.filter,
ignoreHidden: (section.ignoreHidden === undefined) ? defaults.ignoreHidden : section.ignoreHidden,
restart: (section.restart === undefined) ? defaults.restart : section.restart,
start: (section.start === undefined) ? defaults.start : section.start,
directory: section.directory,
command: section.command
};


Loading…
Cancel
Save