Skip to content

Commit

Permalink
Displays version on debug = true (#839)
Browse files Browse the repository at this point in the history
  • Loading branch information
eternauta1337 authored and macor161 committed Oct 30, 2019
1 parent 972a716 commit cc370b9
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions packages/aragon-cli/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,18 @@ const { ens } = require('@aragon/aragen')
const ConsoleReporter = require('@aragon/cli-utils/src/reporters/ConsoleReporter')
const url = require('url')

const reporter = new ConsoleReporter()

const debugMiddleware = argv => {
if (argv.debug || process.env.DEBUG) {
global.DEBUG_MODE = true
reporter.debug(`aragonCLI version: ${require('../package.json').version}`)
reporter.debug(`argv: ${JSON.stringify(process.argv)}`)
}
}

const MIDDLEWARES = [
debugMiddleware,
manifestMiddleware,
moduleMiddleware,
environmentMiddleware,
Expand Down Expand Up @@ -53,12 +64,7 @@ cmd.option('debug', {
description: 'Show more output to terminal',
boolean: true,
default: false,
coerce: debug => {
if (debug || process.env.DEBUG) {
global.DEBUG_MODE = true
return true
}
},
coerce: debug => debug || process.env.DEBUG,
})

cmd.option('gas-price', {
Expand Down Expand Up @@ -148,8 +154,6 @@ cmd.option('apm', {
cmd.epilogue('For more information, check out https://hack.aragon.org')

// Run
const reporter = new ConsoleReporter()
reporter.debug(JSON.stringify(process.argv)) // TODO: this ain't working (DEBUG_MODE not set yet?)
cmd
.fail((msg, err, yargs) => {
reporter.error(msg || err.message || 'An error occurred')
Expand Down

0 comments on commit cc370b9

Please sign in to comment.