Skip to content

Commit

Permalink
control no-spinner from env var
Browse files Browse the repository at this point in the history
  • Loading branch information
todor-a committed Feb 3, 2023
1 parent ba2b3e7 commit 9b41fe4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@

const path = require('path');
const process = require('process');
const program = require('commander');
const {Command, Option} = require('commander');
const rc = require('rc')('madge');
const version = require('../package.json').version;
const ora = require('ora');
const chalk = require('chalk');
const startTime = Date.now();

const program = new Command();

// Revert https://github.com/tj/commander.js/pull/1409
program.storeOptionsAsProperties();

Expand All @@ -34,7 +36,7 @@ program
.option('--ts-config <file>', 'path to typescript config')
.option('--include-npm', 'include shallow NPM modules', false)
.option('--no-color', 'disable color in output and image', false)
.option('--no-spinner', 'disable progress spinner', false)
.addOption(new Option('--no-spinner', 'disable progress spinner', false).env(process.env.MADGE_NO_SPINNER))
.option('--stdin', 'read predefined tree from STDIN', false)
.option('--warning', 'show warnings about skipped files', false)
.option('--debug', 'turn on debug output', false)
Expand Down Expand Up @@ -75,7 +77,8 @@ const spinner = ora({
text: 'Finding files',
color: 'white',
interval: 100000,
isEnabled: program.spinner
isEnabled: program.spinner,
isSilent: Boolean(process.env.MADGE_NO_SPINNER)
});

let exitCode = 0;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
"dependencies": {
"chalk": "^4.1.1",
"commander": "^7.2.0",
"commander": "^8.2.0",
"commondir": "^1.0.1",
"debug": "^4.3.1",
"dependency-tree": "^9.0.0",
Expand Down

0 comments on commit 9b41fe4

Please sign in to comment.