UNPKG

7.05 kBMarkdownView Raw
1@oclif/plugin-plugins
2=====================
3
4plugins plugin for oclif
5
6[![Version](https://img.shields.io/npm/v/@oclif/plugin-plugins.svg)](https://npmjs.org/package/@oclif/plugin-plugins)
7[![CircleCI](https://circleci.com/gh/oclif/plugin-plugins/tree/master.svg?style=shield)](https://circleci.com/gh/oclif/plugin-plugins/tree/master)
8[![Appveyor CI](https://ci.appveyor.com/api/projects/status/github/oclif/plugin-plugins?branch=master&svg=true)](https://ci.appveyor.com/project/oclif/plugin-plugins/branch/master)
9[![Known Vulnerabilities](https://snyk.io/test/github/oclif/plugin-plugins/badge.svg)](https://snyk.io/test/github/oclif/plugin-plugins)
10[![Downloads/week](https://img.shields.io/npm/dw/@oclif/plugin-plugins.svg)](https://npmjs.org/package/@oclif/plugin-plugins)
11[![License](https://img.shields.io/npm/l/@oclif/plugin-plugins.svg)](https://github.com/oclif/plugin-plugins/blob/master/package.json)
12
13<!-- toc -->
14* [What is this?](#what-is-this)
15* [Usage](#usage)
16* [Friendly names](#friendly-names)
17* [Aliases](#aliases)
18* [Commands](#commands)
19<!-- tocstop -->
20
21# What is this?
22
23This plugin is used to allow users to install plugins into your oclif CLI at runtime. For example, in the Heroku CLI this is used to allow people to install plugins such as the Heroku Kafka plugin:
24
25```sh-session
26$ heroku plugins:install heroku-kafka
27$ heroku kafka
28```
29
30This is useful to allow users to create their own plugins to work in your CLI or to allow you to build functionality that users can optionally install.
31
32One particular way this is useful is for building functionality you aren't ready to include in a public repository. Build your plugin separately as a plugin, then include it as a core plugin later into your CLI.
33
34# Usage
35
36First add the plugin to your project with `yarn add @oclif/plugin-plugins`, then add it to the `package.json` of the oclif CLI:
37
38```js
39{
40 "name": "mycli",
41 "version": "0.0.0",
42 // ...
43 "oclif": {
44 "plugins": ["@oclif/plugin-help", "@oclif/plugin-plugins"]
45 }
46}
47```
48
49Now the user can run any of the commands below to manage plugins at runtime.
50
51# Friendly names
52
53To make it simpler for users to install plugins, we have "friendly name" functionality. With this, you can run `mycli plugins:install myplugin` and it will first check if `@mynpmorg/plugin-myplugin` exists on npm before trying to install `myplugin`. This is useful if you want to use a generic name that's already taken in npm.
54
55To set this up, simply set the `oclif.scope` to the name of your npm org. In the example above, this would be `mynpmorg`.
56
57# Aliases
58
59Over time in the Heroku CLI we've changed plugin names, brought plugins into the core of the CLI, or sunset old plugins that no longer function. There is support in this plugin for dealing with these situations.
60
61For renaming plugins, add an alias section to `oclif.aliases` in `package.json`:
62
63```json
64"aliases": {
65 "old-name-plugin": "new-name-plugin"
66}
67```
68
69If a user had `old-name-plugin` installed, the next time the CLI is updated it will remove `old-name-plugin` and install `new-name-plugin`. If a user types `mycli plugins:install old-name-plugin` it will actually install `new-name-plugin` instead.
70
71For removing plugins that are no longer needed (either because they're sunset or because they've been moved into core), set the alias to null:
72
73```json
74"aliases": {
75 "old-name-plugin": null
76}
77```
78
79`old-name-plugin` will be autoremoved on the next update and will not be able to be installed with `mycli plugins:install old-name-plugin`.
80
81# Commands
82<!-- commands -->
83* [`mycli plugins`](#mycli-plugins)
84* [`mycli plugins:inspect PLUGIN...`](#mycli-pluginsinspect-plugin)
85* [`mycli plugins:install PLUGIN...`](#mycli-pluginsinstall-plugin)
86* [`mycli plugins:link PLUGIN`](#mycli-pluginslink-plugin)
87* [`mycli plugins:uninstall PLUGIN...`](#mycli-pluginsuninstall-plugin)
88* [`mycli plugins:update`](#mycli-pluginsupdate)
89
90## `mycli plugins`
91
92list installed plugins
93
94```
95USAGE
96 $ mycli plugins
97
98OPTIONS
99 --core show core plugins
100
101EXAMPLE
102 $ mycli plugins
103```
104
105_See code: [src/commands/plugins/index.ts](https://github.com/oclif/plugin-plugins/blob/v1.10.1/src/commands/plugins/index.ts)_
106
107## `mycli plugins:inspect PLUGIN...`
108
109displays installation properties of a plugin
110
111```
112USAGE
113 $ mycli plugins:inspect PLUGIN...
114
115ARGUMENTS
116 PLUGIN [default: .] plugin to inspect
117
118OPTIONS
119 -h, --help show CLI help
120 -v, --verbose
121
122EXAMPLE
123 $ mycli plugins:inspect myplugin
124```
125
126_See code: [src/commands/plugins/inspect.ts](https://github.com/oclif/plugin-plugins/blob/v1.10.1/src/commands/plugins/inspect.ts)_
127
128## `mycli plugins:install PLUGIN...`
129
130installs a plugin into the CLI
131
132```
133USAGE
134 $ mycli plugins:install PLUGIN...
135
136ARGUMENTS
137 PLUGIN plugin to install
138
139OPTIONS
140 -f, --force yarn install with force flag
141 -h, --help show CLI help
142 -v, --verbose
143
144DESCRIPTION
145 Can be installed from npm or a git url.
146
147 Installation of a user-installed plugin will override a core plugin.
148
149 e.g. If you have a core plugin that has a 'hello' command, installing a user-installed plugin with a 'hello' command
150 will override the core plugin implementation. This is useful if a user needs to update core plugin functionality in
151 the CLI without the need to patch and update the whole CLI.
152
153ALIASES
154 $ mycli plugins:add
155
156EXAMPLES
157 $ mycli plugins:install myplugin
158 $ mycli plugins:install https://github.com/someuser/someplugin
159 $ mycli plugins:install someuser/someplugin
160```
161
162_See code: [src/commands/plugins/install.ts](https://github.com/oclif/plugin-plugins/blob/v1.10.1/src/commands/plugins/install.ts)_
163
164## `mycli plugins:link PLUGIN`
165
166links a plugin into the CLI for development
167
168```
169USAGE
170 $ mycli plugins:link PLUGIN
171
172ARGUMENTS
173 PATH [default: .] path to plugin
174
175OPTIONS
176 -h, --help show CLI help
177 -v, --verbose
178
179DESCRIPTION
180 Installation of a linked plugin will override a user-installed or core plugin.
181
182 e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
183 command will override the user-installed or core plugin implementation. This is useful for development work.
184
185EXAMPLE
186 $ mycli plugins:link myplugin
187```
188
189_See code: [src/commands/plugins/link.ts](https://github.com/oclif/plugin-plugins/blob/v1.10.1/src/commands/plugins/link.ts)_
190
191## `mycli plugins:uninstall PLUGIN...`
192
193removes a plugin from the CLI
194
195```
196USAGE
197 $ mycli plugins:uninstall PLUGIN...
198
199ARGUMENTS
200 PLUGIN plugin to uninstall
201
202OPTIONS
203 -h, --help show CLI help
204 -v, --verbose
205
206ALIASES
207 $ mycli plugins:unlink
208 $ mycli plugins:remove
209```
210
211_See code: [src/commands/plugins/uninstall.ts](https://github.com/oclif/plugin-plugins/blob/v1.10.1/src/commands/plugins/uninstall.ts)_
212
213## `mycli plugins:update`
214
215update installed plugins
216
217```
218USAGE
219 $ mycli plugins:update
220
221OPTIONS
222 -h, --help show CLI help
223 -v, --verbose
224```
225
226_See code: [src/commands/plugins/update.ts](https://github.com/oclif/plugin-plugins/blob/v1.10.1/src/commands/plugins/update.ts)_
227<!-- commandsstop -->