From 6afc0fa5b5b053f66bf4cdd7ca272558d7dd7594 Mon Sep 17 00:00:00 2001 From: Philipe Navarro Date: Mon, 10 Sep 2018 14:24:26 -0700 Subject: [PATCH 1/4] feat(cli): add heroku doctor --- packages/cli/src/commands/doctor.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 packages/cli/src/commands/doctor.ts diff --git a/packages/cli/src/commands/doctor.ts b/packages/cli/src/commands/doctor.ts new file mode 100644 index 0000000000..8ff215a1d9 --- /dev/null +++ b/packages/cli/src/commands/doctor.ts @@ -0,0 +1,23 @@ +import {Command} from '@heroku-cli/command' + +export default class extends Command { + static description = 'debugging output for Heroku support tickets' + + static examples = [ + '$ heroku doctor', + ] + + static flags = { + } + + async run() { + // version + this.log(this.config.userAgent) + // heroku env vars + let envVars = [] + for (let envs of Object.keys(process.env)) { + if (envs.match(/^HEROKU_/)) envVars.push(envs) + } + this.log(envVars.length ? envVars.join(', ') : '(no env vars set)') + } +} From 8444d2fc4fdc77f0ef92429715a333645716e314 Mon Sep 17 00:00:00 2001 From: Philipe Navarro Date: Mon, 10 Sep 2018 14:30:16 -0700 Subject: [PATCH 2/4] make it hidden --- packages/cli/src/commands/doctor.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/cli/src/commands/doctor.ts b/packages/cli/src/commands/doctor.ts index 8ff215a1d9..17fa233d46 100644 --- a/packages/cli/src/commands/doctor.ts +++ b/packages/cli/src/commands/doctor.ts @@ -2,6 +2,7 @@ import {Command} from '@heroku-cli/command' export default class extends Command { static description = 'debugging output for Heroku support tickets' + static hidden = true static examples = [ '$ heroku doctor', From 5a0f836fe213b372da4a415a929094f988b79e97 Mon Sep 17 00:00:00 2001 From: Philipe Navarro Date: Tue, 18 Sep 2018 13:08:10 -0700 Subject: [PATCH 3/4] remove doctor --- packages/cli/package.json | 3 ++- packages/cli/src/commands/doctor.ts | 24 ------------------------ 2 files changed, 2 insertions(+), 25 deletions(-) delete mode 100644 packages/cli/src/commands/doctor.ts diff --git a/packages/cli/package.json b/packages/cli/package.json index d24c031d85..2ee0241b42 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -221,7 +221,8 @@ }, "hooks": { "init": [ - "./lib/hooks/init/refresh" + "./lib/hooks/init/refresh", + "./lib/hooks/init/version" ], "prerun": [ "./lib/hooks/prerun/analytics" diff --git a/packages/cli/src/commands/doctor.ts b/packages/cli/src/commands/doctor.ts deleted file mode 100644 index 17fa233d46..0000000000 --- a/packages/cli/src/commands/doctor.ts +++ /dev/null @@ -1,24 +0,0 @@ -import {Command} from '@heroku-cli/command' - -export default class extends Command { - static description = 'debugging output for Heroku support tickets' - static hidden = true - - static examples = [ - '$ heroku doctor', - ] - - static flags = { - } - - async run() { - // version - this.log(this.config.userAgent) - // heroku env vars - let envVars = [] - for (let envs of Object.keys(process.env)) { - if (envs.match(/^HEROKU_/)) envVars.push(envs) - } - this.log(envVars.length ? envVars.join(', ') : '(no env vars set)') - } -} From 2e869fd21a547d478fcdd023e8e850ff6002412a Mon Sep 17 00:00:00 2001 From: Philipe Navarro Date: Tue, 18 Sep 2018 13:09:47 -0700 Subject: [PATCH 4/4] add hook --- packages/cli/src/hooks/init/version.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 packages/cli/src/hooks/init/version.ts diff --git a/packages/cli/src/hooks/init/version.ts b/packages/cli/src/hooks/init/version.ts new file mode 100644 index 0000000000..cfd64c651b --- /dev/null +++ b/packages/cli/src/hooks/init/version.ts @@ -0,0 +1,12 @@ +import {Hook} from '@oclif/config' + +export const migrate: Hook<'init'> = async function () { + if (['-v', '--version', 'version'].includes(process.argv[2])) { + for (let envs of Object.keys(process.env)) { + if (envs.match(/^HEROKU_/) && envs !== 'HEROKU_UPDATE_INSTRUCTIONS') { + let value = envs === 'HEROKU_API_KEY' ? 'to [REDACTED]' : `to ${process.env[envs]}` + this.warn(`${envs} set ${value}`) + } + } + } +}