diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-05-24 15:10:37 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-05-24 15:11:17 +0200 |
commit | 7a3df06eb573d36142bd1a8e03c5ce8752d300b3 (patch) | |
tree | 70bfaea8884c374876f607774850a3a51c0cb381 /node_modules/shelljs/src/echo.js | |
parent | aca1143cb9eed16cf37f04e475e4257418dd18ac (diff) |
fix build issues and add typedoc
Diffstat (limited to 'node_modules/shelljs/src/echo.js')
-rw-r--r-- | node_modules/shelljs/src/echo.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/node_modules/shelljs/src/echo.js b/node_modules/shelljs/src/echo.js new file mode 100644 index 000000000..2b0e7d919 --- /dev/null +++ b/node_modules/shelljs/src/echo.js @@ -0,0 +1,34 @@ +var common = require('./common'); + +common.register('echo', _echo, { + allowGlobbing: false, +}); + +//@ +//@ ### echo([options,] string [, string ...]) +//@ Available options: +//@ +//@ + `-e`: interpret backslash escapes (default) +//@ +//@ Examples: +//@ +//@ ```javascript +//@ echo('hello world'); +//@ var str = echo('hello world'); +//@ ``` +//@ +//@ Prints string to stdout, and returns string with additional utility methods +//@ like `.to()`. +function _echo(opts, messages) { + // allow strings starting with '-', see issue #20 + messages = [].slice.call(arguments, opts ? 0 : 1); + + if (messages[0] === '-e') { + // ignore -e + messages.shift(); + } + + console.log.apply(console, messages); + return messages.join(' '); +} +module.exports = _echo; |