From 425b21a661baa4f0fd500d5468f6a23422c03d75 Mon Sep 17 00:00:00 2001 From: Ho Duc Ha Date: Tue, 17 Jan 2017 16:55:19 +0700 Subject: [PATCH] Add ability to disable the spinner (#34) --- index.js | 2 +- readme.md | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 76da9f6..d351618 100644 --- a/index.js +++ b/index.js @@ -31,7 +31,7 @@ class Ora { this.stream = this.options.stream; this.id = null; this.frameIndex = 0; - this.enabled = this.options.enabled || ((this.stream && this.stream.isTTY) && !process.env.CI); + this.enabled = typeof this.options.enabled === 'boolean' ? this.options.enabled : ((this.stream && this.stream.isTTY) && !process.env.CI); } frame() { const frames = this.spinner.frames; diff --git a/readme.md b/readme.md index 4e70d43..f59f75d 100644 --- a/readme.md +++ b/readme.md @@ -88,10 +88,9 @@ You could for example set this to `process.stdout` instead. ##### enabled -Type: `boolean`
-Default: `false` +Type: `boolean` -Force enabling of the spinner regardless of the `stream` not being run inside a TTY context and/or in a CI environment. +Force enable/disable the spinner. If not specified, the spinner will be enabled if the `stream` is being run inside a TTY context (not spawned or piped) and/or not in a CI environment. ### Instance