Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2014-05-08 02:17:26 +0400
committerisaacs <i@izs.me>2014-05-08 02:18:38 +0400
commitbf761dddd14ce07b7070a38ec0661d4a21e7577f (patch)
tree3e78912ffb5be5c51caa8feee99ef1d34f39c85f /lib/npm.js
parent7fc87498678ecd602f5f5c37cc930a61670af264 (diff)
Busy Spinner, no http noise
One step closer to #5213
Diffstat (limited to 'lib/npm.js')
-rw-r--r--lib/npm.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/npm.js b/lib/npm.js
index 613bf0095..44c132f2c 100644
--- a/lib/npm.js
+++ b/lib/npm.js
@@ -30,6 +30,7 @@ var EventEmitter = require("events").EventEmitter
, slide = require("slide")
, chain = slide.chain
, RegClient = require("npm-registry-client")
+ , charSpin = require("char-spinner")
npm.config = {
loaded: false,
@@ -182,6 +183,21 @@ var commandCache = {}
})
, abbrevs = abbrev(fullList)
+npm.spinner =
+ { int: null
+ , start: function () {
+ if (npm.spinner.int) return
+ var c = npm.config.get("spin")
+ if (!c) return
+ var stream = npm.config.get("logstream")
+ var opt = { tty: c !== "always", stream: stream }
+ npm.spinner.int = charSpin(opt)
+ }
+ , stop: function () {
+ clearInterval(npm.spinner.int)
+ }
+ }
+
Object.keys(abbrevs).concat(plumbing).forEach(function addCommand (c) {
Object.defineProperty(npm.commands, c, { get : function () {
if (!loaded) throw new Error(
@@ -204,6 +220,8 @@ Object.keys(abbrevs).concat(plumbing).forEach(function addCommand (c) {
}
if (args.length === 1) args.unshift([])
+ npm.spinner.start()
+
if (!npm.registry.refer) {
npm.registry.refer = [a].concat(args[0]).map(function (arg) {
// exclude anything that might be a URL, path, or private module