diff options
author | isaacs <i@izs.me> | 2014-06-05 00:11:06 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2014-06-05 00:11:06 +0400 |
commit | 2006a5271374167f32233eca96171e80b6699ae3 (patch) | |
tree | aa88d97e1209969fecaae5e7b2518ac0e1be6cc8 | |
parent | acb63b4720b65dfcb39f67c6016921832a159ded (diff) |
char-spinner: update to not bork windows
-rw-r--r-- | node_modules/char-spinner/README.md | 2 | ||||
-rw-r--r-- | node_modules/char-spinner/package.json | 26 | ||||
-rw-r--r-- | node_modules/char-spinner/spin.js | 14 | ||||
-rw-r--r-- | node_modules/char-spinner/test/basic.js | 2 | ||||
-rw-r--r-- | package.json | 2 |
5 files changed, 35 insertions, 11 deletions
diff --git a/node_modules/char-spinner/README.md b/node_modules/char-spinner/README.md index b202f4cdd..b1290f592 100644 --- a/node_modules/char-spinner/README.md +++ b/node_modules/char-spinner/README.md @@ -5,7 +5,7 @@ Put a little spinner on process.stderr, as unobtrusively as possible. ## USAGE ```javascript -var spinner = require("spinner") +var spinner = require("char-spinner") // All options are optional // even the options argument itself is optional diff --git a/node_modules/char-spinner/package.json b/node_modules/char-spinner/package.json index b2760afa6..91092d84b 100644 --- a/node_modules/char-spinner/package.json +++ b/node_modules/char-spinner/package.json @@ -1,6 +1,6 @@ { "name": "char-spinner", - "version": "1.0.0", + "version": "1.0.1", "description": "Put a little spinner on process.stderr, as unobtrusively as possible.", "main": "spin.js", "directories": { @@ -31,10 +31,24 @@ "url": "https://github.com/isaacs/char-spinner/issues" }, "homepage": "https://github.com/isaacs/char-spinner", - "readme": "# char-spinner\n\nPut a little spinner on process.stderr, as unobtrusively as possible.\n\n## USAGE\n\n```javascript\nvar spinner = require(\"spinner\")\n\n// All options are optional\n// even the options argument itself is optional\nspinner(options)\n```\n\n## OPTIONS\n\nUsually the defaults are what you want. Mostly they're just\nconfigurable for testing purposes.\n\n* `stream` Output stream. Default=`process.stderr`\n* `tty` Only show spinner if output stream has a truish `.isTTY`. Default=`true`\n* `string` String of chars to spin. Default=`'/-\\\\|'`\n* `interval` Number of ms between frames, bigger = slower. Default=`50`\n* `cleanup` Print `'\\r \\r'` to stream on process exit. Default=`true`\n* `unref` Unreference the spinner interval so that the process can\n exit normally. Default=`true`\n* `delay` Number of frames to \"skip over\" before printing the spinner.\n Useful if you want to avoid showing the spinner for very fast\n actions. Default=`2`\n\nReturns the generated interval, if one was created.\n", - "readmeFilename": "README.md", - "_id": "char-spinner@1.0.0", - "_shasum": "b5fadba903f242a31c1e93b2f532482d62bb56b2", + "gitHead": "091b2ff5960aa083f68a5619fa93999d072aa152", + "_id": "char-spinner@1.0.1", + "_shasum": "e6ea67bd247e107112983b7ab0479ed362800081", "_from": "char-spinner@latest", - "_resolved": "https://registry.npmjs.org/char-spinner/-/char-spinner-1.0.0.tgz" + "_npmVersion": "1.4.13", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "dist": { + "shasum": "e6ea67bd247e107112983b7ab0479ed362800081", + "tarball": "http://registry.npmjs.org/char-spinner/-/char-spinner-1.0.1.tgz" + }, + "_resolved": "https://registry.npmjs.org/char-spinner/-/char-spinner-1.0.1.tgz" } diff --git a/node_modules/char-spinner/spin.js b/node_modules/char-spinner/spin.js index 1068d3253..cae8540c6 100644 --- a/node_modules/char-spinner/spin.js +++ b/node_modules/char-spinner/spin.js @@ -8,6 +8,8 @@ function spinner(opt) { var ms = typeof opt.interval === 'number' ? opt.interval : 50 if (ms < 0) ms = 0 if (tty && !str.isTTY) return false + var CR = str.isTTY ? '\u001b[0G' : '\u000d'; + var CLEAR = str.isTTY ? '\u001b[2K' : '\u000d \u000d'; var s = 0 var sprite = string.split('') @@ -19,7 +21,7 @@ function spinner(opt) { if (--delay >= 0) return s = ++s % sprite.length var c = sprite[s] - str.write('\r \r' + c + '\r') + str.write(c + CR) wrote = true }, ms) @@ -32,10 +34,18 @@ function spinner(opt) { if (cleanup) { process.on('exit', function() { if (wrote) { - str.write('\r \r') + str.write(CLEAR); } }) } + module.exports.clear = function () { + str.write(CLEAR); + }; + return interval } + +module.exports.clear = function () {}; + + diff --git a/node_modules/char-spinner/test/basic.js b/node_modules/char-spinner/test/basic.js index f3c1dfe2b..ed91b984f 100644 --- a/node_modules/char-spinner/test/basic.js +++ b/node_modules/char-spinner/test/basic.js @@ -14,7 +14,7 @@ test('does nothing when not a tty', function(t) { test('write spinny stuff', function(t) { var output = '' var written = 0 - var expect = "\r \rb\r\r \rc\r\r \rd\r\r \re\r\r \rf\r\r \rg\r\r \rh\r\r \ri\r\r \rj\r\r \rk\r\r \rl\r\r \rm\r\r \rn\r\r \ro\r\r \rp\r\r \ra\r\r \rb\r\r \rc\r\r \rd\r\r \re\r\r \rf\r\r \rg\r\r \rh\r\r \ri\r\r \rj\r\r \rk\r\r \rl\r\r \rm\r\r \rn\r\r \ro\r\r \rp\r\r \ra\r\r \rb\r\r \rc\r\r \rd\r\r \re\r\r \rf\r\r \rg\r\r \rh\r\r \ri\r\r \rj\r\r \rk\r\r \rl\r\r \rm\r\r \rn\r\r \ro\r\r \rp\r\r \ra\r\r \rb\r\r \rc\r" + var expect = "b\u001b[0Gc\u001b[0Gd\u001b[0Ge\u001b[0Gf\u001b[0Gg\u001b[0Gh\u001b[0Gi\u001b[0Gj\u001b[0Gk\u001b[0Gl\u001b[0Gm\u001b[0Gn\u001b[0Go\u001b[0Gp\u001b[0Ga\u001b[0Gb\u001b[0Gc\u001b[0Gd\u001b[0Ge\u001b[0Gf\u001b[0Gg\u001b[0Gh\u001b[0Gi\u001b[0Gj\u001b[0Gk\u001b[0Gl\u001b[0Gm\u001b[0Gn\u001b[0Go\u001b[0Gp\u001b[0Ga\u001b[0Gb\u001b[0Gc\u001b[0Gd\u001b[0Ge\u001b[0Gf\u001b[0Gg\u001b[0Gh\u001b[0Gi\u001b[0Gj\u001b[0Gk\u001b[0Gl\u001b[0Gm\u001b[0Gn\u001b[0Go\u001b[0Gp\u001b[0Ga\u001b[0Gb\u001b[0Gc\u001b[0G" var int = spinner({ interval: 0, diff --git a/package.json b/package.json index 26920a00a..8bf403c38 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "ansistyles": "~0.1.3", "archy": "0", "block-stream": "0.0.7", - "char-spinner": "~1.0.0", + "char-spinner": "~1.0.1", "child-process-close": "~0.1.1", "chmodr": "~0.1.0", "chownr": "0", |