diff --git a/bin/tend b/bin/tend
index b470ee9..07c23ce 100755
--- a/bin/tend
+++ b/bin/tend
@@ -7,13 +7,14 @@ var doc = [
'Usage:',
' tend',
' tend (--help | --version)',
- ' tend [--restart] [--ignoreHidden] [
] []',
+ ' tend [--restart] [--start] [--ignoreHidden] [ ] []',
'',
'Options:',
' -h --help Show this help text',
' -v --version Show tend version information',
' -r --restart If 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 as soon as tend executes',
].join('\r\n');
var args = docopt.docopt(doc, {
@@ -36,6 +37,7 @@ if (args[''] && args['']) {
filter: args[''],
ignoreHidden: args['--ignoreHidden'],
restart: args['--restart'],
+ start: args['--start'],
command: args[''],
directory: args[''],
}
diff --git a/lib/index.js b/lib/index.js
index 4bbe590..eeadc56 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -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
};