Skip to content

Commit

Permalink
fix: error out when plugin not found
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed May 3, 2018
1 parent 7ace2d2 commit 330d957
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 56 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"bugs": "https://github.com/oclif/plugin-plugins/issues",
"dependencies": {
"@heroku-cli/color": "^1.1.3",
"@oclif/command": "^1.4.18",
"@oclif/command": "^1.4.20",
"chalk": "^2.4.1",
"cli-ux": "^3.4.1",
"debug": "^3.1.0",
Expand All @@ -19,17 +19,17 @@
"yarn": "^1.6.0"
},
"devDependencies": {
"@oclif/config": "^1.6.16",
"@oclif/dev-cli": "^1.13.12",
"@oclif/errors": "^1.0.7",
"@oclif/plugin-help": "^1.2.7",
"@oclif/test": "^1.0.5",
"@oclif/config": "^1.6.17",
"@oclif/dev-cli": "^1.13.15",
"@oclif/errors": "^1.0.8",
"@oclif/plugin-help": "^1.2.10",
"@oclif/test": "^1.0.6",
"@oclif/tslint": "^1.1.0",
"@types/chai": "^4.1.3",
"@types/fs-extra": "^5.0.2",
"@types/load-json-file": "^2.0.7",
"@types/mocha": "^5.2.0",
"@types/node": "^10.0.2",
"@types/node": "^8.10.12",
"@types/semver": "^5.5.0",
"@types/supports-color": "^5.3.0",
"chai": "^4.1.2",
Expand Down
1 change: 1 addition & 0 deletions src/commands/plugins/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default class PluginsInstall extends Command {
static examples = ['$ <%= config.bin %> plugins:install <%- config.pjson.oclif.examplePlugin || "heroku-production-status" %> ']
static strict = false
static args = [{name: 'plugin', description: 'plugin to install', required: true}]
static aliases = ['plugins:add']

plugins = new Plugins(this.config)

Expand Down
5 changes: 2 additions & 3 deletions src/commands/plugins/uninstall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default class PluginsUninstall extends Command {
`
static variableArgs = true
static args = [{name: 'plugin', description: 'plugin to uninstall', required: true}]
static aliases = ['plugins:unlink']
static aliases = ['plugins:unlink', 'plugins:remove']

plugins = new Plugins(this.config)

Expand All @@ -36,8 +36,7 @@ export default class PluginsUninstall extends Command {
cli.action.start(`Uninstalling ${friendly}`)
const unfriendly = await this.plugins.hasPlugin(plugin)
if (!unfriendly) {
cli.warn(`${friendly} is not installed`)
continue
return this.error(`${friendly} is not installed`)
}
await this.plugins.uninstall(unfriendly.name)
cli.action.stop()
Expand Down
8 changes: 8 additions & 0 deletions test/commands/plugins/uninstall.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {test} from '../../test'

describe('command', () => {
test
.command(['plugins:uninstall', 'foobar'], {reset: true})
.catch(/foobar is not installed/)
.it('uninstall non-existent plugin')
})
75 changes: 29 additions & 46 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -34,51 +34,41 @@
call-me-maybe "^1.0.1"
glob-to-regexp "^0.3.0"

"@oclif/command@^1.4.17", "@oclif/command@^1.4.18":
version "1.4.18"
resolved "https://registry.yarnpkg.com/@oclif/command/-/command-1.4.18.tgz#1095bab6917287a5e87eb7529d4d39d7fc53d362"
"@oclif/command@^1.4.20":
version "1.4.20"
resolved "https://registry.yarnpkg.com/@oclif/command/-/command-1.4.20.tgz#7368c9c9f7f596fc8efffd7ec89118feed5203d8"
dependencies:
"@oclif/errors" "^1.0.6"
"@oclif/errors" "^1.0.8"
"@oclif/parser" "^3.3.3"
debug "^3.1.0"
semver "^5.5.0"

"@oclif/config@^1.6.16":
version "1.6.16"
resolved "https://registry.yarnpkg.com/@oclif/config/-/config-1.6.16.tgz#6bcb03bf30ee54eeafa788777d965bf47bb5047d"
"@oclif/config@^1.6.17":
version "1.6.17"
resolved "https://registry.yarnpkg.com/@oclif/config/-/config-1.6.17.tgz#e9608f56e5acd49fcaf3bbfcc3e8818d81b1ba12"
dependencies:
debug "^3.1.0"

"@oclif/dev-cli@^1.13.12":
version "1.13.12"
resolved "https://registry.yarnpkg.com/@oclif/dev-cli/-/dev-cli-1.13.12.tgz#444edc1e4b4798ab369e90a797aa7a43534d6777"
"@oclif/dev-cli@^1.13.15":
version "1.13.15"
resolved "https://registry.yarnpkg.com/@oclif/dev-cli/-/dev-cli-1.13.15.tgz#cc02e5b8c1fdb9b04973926e5b9f034c3f7ed64c"
dependencies:
"@oclif/command" "^1.4.17"
"@oclif/config" "^1.6.16"
"@oclif/errors" "^1.0.6"
"@oclif/plugin-help" "^1.2.6"
"@oclif/command" "^1.4.20"
"@oclif/config" "^1.6.17"
"@oclif/errors" "^1.0.8"
"@oclif/plugin-help" "^1.2.10"
cli-ux "^3.4.1"
debug "^3.1.0"
fs-extra "^5.0.0"
fs-extra "^6.0.0"
lodash "^4.17.10"
normalize-package-data "^2.4.0"
qqjs "^0.3.8"
require-resolve "^0.0.2"
tslib "^1.9.0"

"@oclif/errors@^1.0.6":
version "1.0.6"
resolved "https://registry.yarnpkg.com/@oclif/errors/-/errors-1.0.6.tgz#76b17906ac1beea252add52e8e8ed78229c33a7b"
dependencies:
clean-stack "^1.3.0"
fs-extra "^5.0.0"
indent-string "^3.2.0"
strip-ansi "^4.0.0"
wrap-ansi "^3.0.1"

"@oclif/errors@^1.0.7":
version "1.0.7"
resolved "https://registry.yarnpkg.com/@oclif/errors/-/errors-1.0.7.tgz#13d7205801944c341534370e65140d21ab929e24"
"@oclif/errors@^1.0.8":
version "1.0.8"
resolved "https://registry.yarnpkg.com/@oclif/errors/-/errors-1.0.8.tgz#2f8239267506bb7c3f5fd776144c2686e5b7fff7"
dependencies:
clean-stack "^1.3.0"
fs-extra "^6.0.0"
Expand All @@ -97,11 +87,11 @@
"@oclif/linewrap" "^1.0.0"
chalk "^2.4.0"

"@oclif/plugin-help@^1.2.6", "@oclif/plugin-help@^1.2.7":
version "1.2.7"
resolved "https://registry.yarnpkg.com/@oclif/plugin-help/-/plugin-help-1.2.7.tgz#4fdfa9cfe53b8bc68b6fabba1126e13debebc87b"
"@oclif/plugin-help@^1.2.10":
version "1.2.10"
resolved "https://registry.yarnpkg.com/@oclif/plugin-help/-/plugin-help-1.2.10.tgz#c2bb2b8f09027bf5a55e96346b8525d4dcff8c3e"
dependencies:
"@oclif/command" "^1.4.18"
"@oclif/command" "^1.4.20"
chalk "^2.4.1"
indent-string "^3.2.0"
lodash.template "^4.4.0"
Expand All @@ -113,11 +103,11 @@
version "1.0.2"
resolved "https://registry.yarnpkg.com/@oclif/screen/-/screen-1.0.2.tgz#c9d7c84b0ea60ecec8dd7a9b22c012ba9967aed8"

"@oclif/test@^1.0.5":
version "1.0.5"
resolved "https://registry.yarnpkg.com/@oclif/test/-/test-1.0.5.tgz#2b8e8384148a75c6cc6ef20df54cfa55cde15d4e"
"@oclif/test@^1.0.6":
version "1.0.6"
resolved "https://registry.yarnpkg.com/@oclif/test/-/test-1.0.6.tgz#45dbab5610caed9f178e33ff6b416f6ce2dc245c"
dependencies:
fancy-test "^1.0.5"
fancy-test "^1.0.6"

"@oclif/tslint@^1.1.0":
version "1.1.0"
Expand Down Expand Up @@ -147,9 +137,9 @@
version "9.6.5"
resolved "https://registry.yarnpkg.com/@types/node/-/node-9.6.5.tgz#ee700810fdf49ac1c399fc5980b7559b3e5a381d"

"@types/node@^10.0.2":
version "10.0.2"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.0.2.tgz#180046ebbc37de8b64777765c2486ebecb59448e"
"@types/node@^8.10.12":
version "8.10.12"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.12.tgz#dcb66f6de39074a296534bd1a256a3c6a1c8f5b5"

"@types/semver@^5.5.0":
version "5.5.0"
Expand Down Expand Up @@ -647,13 +637,6 @@ extract-stack@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/extract-stack/-/extract-stack-1.0.0.tgz#b97acaf9441eea2332529624b732fc5a1c8165fa"

fancy-test@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/fancy-test/-/fancy-test-1.0.5.tgz#323970de576f7dc0938402c3a731ee4d59896a11"
dependencies:
lodash "^4.17.5"
stdout-stderr "^0.1.9"

fancy-test@^1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/fancy-test/-/fancy-test-1.0.6.tgz#e0a061ecdcfb9d8fbea1f86375ed26e258ed7243"
Expand Down

0 comments on commit 330d957

Please sign in to comment.