Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Commit

Permalink
fix(cli): Added note when trying 'cluster info'
Browse files Browse the repository at this point in the history
  • Loading branch information
timsuchanek committed Jan 22, 2018
1 parent 932a155 commit f000309
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
23 changes: 5 additions & 18 deletions cli/packages/prisma-cli-engine/src/CLI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import * as Raven from 'raven'
import * as os from 'os'
import * as jwt from 'jsonwebtoken'
import { getIsGlobal } from './utils/isGlobal'
import { CommandReplacedError } from './errors/CommandReplacedError'

Raven.config(
'https://1e57780fb0bb4b52938cbb3456268121:fc6a6c6fd8cd4bbf81e2cd5c7c814a49@sentry.io/271168',
Expand Down Expand Up @@ -157,25 +158,11 @@ export class CLI {
const checker = getStatusChecker()!
checker.checkStatus(id, {}, {}, [])
} else if (id === 'push') {
throw new Error(
`The ${chalk.bold(
'push',
)} command has been replaced by the ${chalk.bold(
'deploy',
)} command. Get more info with ${chalk.bold.green(
'prisma deploy --help',
)}`,
)
throw new CommandReplacedError('push', 'deploy')
} else if (id === 'cluster:info') {
throw new CommandReplacedError('cluster info', 'cluster list')
} else if (id === 'local:down') {
throw new Error(
`The ${chalk.bold(
'local down',
)} command has been replaced by the ${chalk.bold(
'local nuke',
)} command. Get more info with ${chalk.bold.green(
'prisma local nuke --help',
)}`,
)
throw new CommandReplacedError('local down', 'local nuke')
} else {
return new NotFound(out, this.config.argv).run()
}
Expand Down
12 changes: 12 additions & 0 deletions cli/packages/prisma-cli-engine/src/errors/CommandReplacedError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import chalk from 'chalk'

export class CommandReplacedError extends Error {
constructor(oldCmd: string, newCmd: string) {
super(
`The ${chalk.bold(oldCmd)} command has been replaced by the ${chalk.bold(
newCmd,
)} command.
Get more info with ${chalk.bold.green(`${newCmd} --help`)}`,
)
}
}

0 comments on commit f000309

Please sign in to comment.