1 | # @oclif/plugin-plugins
|
2 |
|
3 | plugins plugin for oclif
|
4 |
|
5 | [![Version](https://img.shields.io/npm/v/@oclif/plugin-plugins.svg)](https://npmjs.org/package/@oclif/plugin-plugins)
|
6 | [![Downloads/week](https://img.shields.io/npm/dw/@oclif/plugin-plugins.svg)](https://npmjs.org/package/@oclif/plugin-plugins)
|
7 | [![License](https://img.shields.io/npm/l/@oclif/plugin-plugins.svg)](https://github.com/oclif/plugin-plugins/blob/main/package.json)
|
8 |
|
9 |
|
10 | * [@oclif/plugin-plugins](#oclifplugin-plugins)
|
11 | * [What is this?](#what-is-this)
|
12 | * [Usage](#usage)
|
13 | * [Friendly names](#friendly-names)
|
14 | * [Aliases](#aliases)
|
15 | * [Commands](#commands)
|
16 | * [Contributing](#contributing)
|
17 |
|
18 |
|
19 | # What is this?
|
20 |
|
21 | This 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:
|
22 |
|
23 | ```sh-session
|
24 | $ heroku plugins:install heroku-kafka
|
25 | $ heroku kafka
|
26 | ```
|
27 |
|
28 | This 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.
|
29 |
|
30 | One 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.
|
31 |
|
32 | # Usage
|
33 |
|
34 | First add the plugin to your project with `yarn add @oclif/plugin-plugins`, then add it to the `package.json` of the oclif CLI:
|
35 |
|
36 | ```js
|
37 | {
|
38 | "name": "mycli",
|
39 | "version": "0.0.0",
|
40 | // ...
|
41 | "oclif": {
|
42 | "plugins": ["@oclif/plugin-help", "@oclif/plugin-plugins"]
|
43 | }
|
44 | }
|
45 | ```
|
46 |
|
47 | Now the user can run any of the commands below to manage plugins at runtime.
|
48 |
|
49 | # Friendly names
|
50 |
|
51 | To 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.
|
52 |
|
53 | To set this up, simply set the `oclif.scope` to the name of your npm org. In the example above, this would be `mynpmorg`.
|
54 |
|
55 | # Aliases
|
56 |
|
57 | Over 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.
|
58 |
|
59 | For renaming plugins, add an alias section to `oclif.aliases` in `package.json`:
|
60 |
|
61 | ```json
|
62 | "aliases": {
|
63 | "old-name-plugin": "new-name-plugin"
|
64 | }
|
65 | ```
|
66 |
|
67 | If 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.
|
68 |
|
69 | For 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:
|
70 |
|
71 | ```json
|
72 | "aliases": {
|
73 | "old-name-plugin": null
|
74 | }
|
75 | ```
|
76 |
|
77 | `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`.
|
78 |
|
79 | # Commands
|
80 |
|
81 |
|
82 | * [`mycli plugins`](#mycli-plugins)
|
83 | * [`mycli plugins add PLUGIN`](#mycli-plugins-add-plugin)
|
84 | * [`mycli plugins:inspect PLUGIN...`](#mycli-pluginsinspect-plugin)
|
85 | * [`mycli plugins install PLUGIN`](#mycli-plugins-install-plugin)
|
86 | * [`mycli plugins link PATH`](#mycli-plugins-link-path)
|
87 | * [`mycli plugins remove [PLUGIN]`](#mycli-plugins-remove-plugin)
|
88 | * [`mycli plugins reset`](#mycli-plugins-reset)
|
89 | * [`mycli plugins uninstall [PLUGIN]`](#mycli-plugins-uninstall-plugin)
|
90 | * [`mycli plugins unlink [PLUGIN]`](#mycli-plugins-unlink-plugin)
|
91 | * [`mycli plugins update`](#mycli-plugins-update)
|
92 |
|
93 | ## `mycli plugins`
|
94 |
|
95 | List installed plugins.
|
96 |
|
97 | ```
|
98 | USAGE
|
99 | $ mycli plugins [--json] [--core]
|
100 |
|
101 | FLAGS
|
102 | --core Show core plugins.
|
103 |
|
104 | GLOBAL FLAGS
|
105 | --json Format output as json.
|
106 |
|
107 | DESCRIPTION
|
108 | List installed plugins.
|
109 |
|
110 | EXAMPLES
|
111 | $ mycli plugins
|
112 | ```
|
113 |
|
114 | _See code: [src/commands/plugins/index.ts](https://github.com/oclif/plugin-plugins/blob/v5.4.21/src/commands/plugins/index.ts)_
|
115 |
|
116 | ## `mycli plugins add PLUGIN`
|
117 |
|
118 | Installs a plugin into mycli.
|
119 |
|
120 | ```
|
121 | USAGE
|
122 | $ mycli plugins add PLUGIN... [--json] [-f] [-h] [-s | -v]
|
123 |
|
124 | ARGUMENTS
|
125 | PLUGIN... Plugin to install.
|
126 |
|
127 | FLAGS
|
128 | -f, --force Force npm to fetch remote resources even if a local copy exists on disk.
|
129 | -h, --help Show CLI help.
|
130 | -s, --silent Silences npm output.
|
131 | -v, --verbose Show verbose npm output.
|
132 |
|
133 | GLOBAL FLAGS
|
134 | --json Format output as json.
|
135 |
|
136 | DESCRIPTION
|
137 | Installs a plugin into mycli.
|
138 |
|
139 | Uses npm to install plugins.
|
140 |
|
141 | Installation of a user-installed plugin will override a core plugin.
|
142 |
|
143 | Use the MYCLI_NPM_LOG_LEVEL environment variable to set the npm loglevel.
|
144 | Use the MYCLI_NPM_REGISTRY environment variable to set the npm registry.
|
145 |
|
146 | ALIASES
|
147 | $ mycli plugins add
|
148 |
|
149 | EXAMPLES
|
150 | Install a plugin from npm registry.
|
151 |
|
152 | $ mycli plugins add myplugin
|
153 |
|
154 | Install a plugin from a github url.
|
155 |
|
156 | $ mycli plugins add https://github.com/someuser/someplugin
|
157 |
|
158 | Install a plugin from a github slug.
|
159 |
|
160 | $ mycli plugins add someuser/someplugin
|
161 | ```
|
162 |
|
163 | ## `mycli plugins:inspect PLUGIN...`
|
164 |
|
165 | Displays installation properties of a plugin.
|
166 |
|
167 | ```
|
168 | USAGE
|
169 | $ mycli plugins inspect PLUGIN...
|
170 |
|
171 | ARGUMENTS
|
172 | PLUGIN... [default: .] Plugin to inspect.
|
173 |
|
174 | FLAGS
|
175 | -h, --help Show CLI help.
|
176 | -v, --verbose
|
177 |
|
178 | GLOBAL FLAGS
|
179 | --json Format output as json.
|
180 |
|
181 | DESCRIPTION
|
182 | Displays installation properties of a plugin.
|
183 |
|
184 | EXAMPLES
|
185 | $ mycli plugins inspect myplugin
|
186 | ```
|
187 |
|
188 | _See code: [src/commands/plugins/inspect.ts](https://github.com/oclif/plugin-plugins/blob/v5.4.21/src/commands/plugins/inspect.ts)_
|
189 |
|
190 | ## `mycli plugins install PLUGIN`
|
191 |
|
192 | Installs a plugin into mycli.
|
193 |
|
194 | ```
|
195 | USAGE
|
196 | $ mycli plugins install PLUGIN... [--json] [-f] [-h] [-s | -v]
|
197 |
|
198 | ARGUMENTS
|
199 | PLUGIN... Plugin to install.
|
200 |
|
201 | FLAGS
|
202 | -f, --force Force npm to fetch remote resources even if a local copy exists on disk.
|
203 | -h, --help Show CLI help.
|
204 | -s, --silent Silences npm output.
|
205 | -v, --verbose Show verbose npm output.
|
206 |
|
207 | GLOBAL FLAGS
|
208 | --json Format output as json.
|
209 |
|
210 | DESCRIPTION
|
211 | Installs a plugin into mycli.
|
212 |
|
213 | Uses npm to install plugins.
|
214 |
|
215 | Installation of a user-installed plugin will override a core plugin.
|
216 |
|
217 | Use the MYCLI_NPM_LOG_LEVEL environment variable to set the npm loglevel.
|
218 | Use the MYCLI_NPM_REGISTRY environment variable to set the npm registry.
|
219 |
|
220 | ALIASES
|
221 | $ mycli plugins add
|
222 |
|
223 | EXAMPLES
|
224 | Install a plugin from npm registry.
|
225 |
|
226 | $ mycli plugins install myplugin
|
227 |
|
228 | Install a plugin from a github url.
|
229 |
|
230 | $ mycli plugins install https://github.com/someuser/someplugin
|
231 |
|
232 | Install a plugin from a github slug.
|
233 |
|
234 | $ mycli plugins install someuser/someplugin
|
235 | ```
|
236 |
|
237 | _See code: [src/commands/plugins/install.ts](https://github.com/oclif/plugin-plugins/blob/v5.4.21/src/commands/plugins/install.ts)_
|
238 |
|
239 | ## `mycli plugins link PATH`
|
240 |
|
241 | Links a plugin into the CLI for development.
|
242 |
|
243 | ```
|
244 | USAGE
|
245 | $ mycli plugins link PATH [-h] [--install] [-v]
|
246 |
|
247 | ARGUMENTS
|
248 | PATH [default: .] path to plugin
|
249 |
|
250 | FLAGS
|
251 | -h, --help Show CLI help.
|
252 | -v, --verbose
|
253 | --[no-]install Install dependencies after linking the plugin.
|
254 |
|
255 | DESCRIPTION
|
256 | Links a plugin into the CLI for development.
|
257 |
|
258 | Installation of a linked plugin will override a user-installed or core plugin.
|
259 |
|
260 | e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
|
261 | command will override the user-installed or core plugin implementation. This is useful for development work.
|
262 |
|
263 |
|
264 | EXAMPLES
|
265 | $ mycli plugins link myplugin
|
266 | ```
|
267 |
|
268 | _See code: [src/commands/plugins/link.ts](https://github.com/oclif/plugin-plugins/blob/v5.4.21/src/commands/plugins/link.ts)_
|
269 |
|
270 | ## `mycli plugins remove [PLUGIN]`
|
271 |
|
272 | Removes a plugin from the CLI.
|
273 |
|
274 | ```
|
275 | USAGE
|
276 | $ mycli plugins remove [PLUGIN...] [-h] [-v]
|
277 |
|
278 | ARGUMENTS
|
279 | PLUGIN... plugin to uninstall
|
280 |
|
281 | FLAGS
|
282 | -h, --help Show CLI help.
|
283 | -v, --verbose
|
284 |
|
285 | DESCRIPTION
|
286 | Removes a plugin from the CLI.
|
287 |
|
288 | ALIASES
|
289 | $ mycli plugins unlink
|
290 | $ mycli plugins remove
|
291 |
|
292 | EXAMPLES
|
293 | $ mycli plugins remove myplugin
|
294 | ```
|
295 |
|
296 | ## `mycli plugins reset`
|
297 |
|
298 | Remove all user-installed and linked plugins.
|
299 |
|
300 | ```
|
301 | USAGE
|
302 | $ mycli plugins reset [--hard] [--reinstall]
|
303 |
|
304 | FLAGS
|
305 | --hard Delete node_modules and package manager related files in addition to uninstalling plugins.
|
306 | --reinstall Reinstall all plugins after uninstalling.
|
307 | ```
|
308 |
|
309 | _See code: [src/commands/plugins/reset.ts](https://github.com/oclif/plugin-plugins/blob/v5.4.21/src/commands/plugins/reset.ts)_
|
310 |
|
311 | ## `mycli plugins uninstall [PLUGIN]`
|
312 |
|
313 | Removes a plugin from the CLI.
|
314 |
|
315 | ```
|
316 | USAGE
|
317 | $ mycli plugins uninstall [PLUGIN...] [-h] [-v]
|
318 |
|
319 | ARGUMENTS
|
320 | PLUGIN... plugin to uninstall
|
321 |
|
322 | FLAGS
|
323 | -h, --help Show CLI help.
|
324 | -v, --verbose
|
325 |
|
326 | DESCRIPTION
|
327 | Removes a plugin from the CLI.
|
328 |
|
329 | ALIASES
|
330 | $ mycli plugins unlink
|
331 | $ mycli plugins remove
|
332 |
|
333 | EXAMPLES
|
334 | $ mycli plugins uninstall myplugin
|
335 | ```
|
336 |
|
337 | _See code: [src/commands/plugins/uninstall.ts](https://github.com/oclif/plugin-plugins/blob/v5.4.21/src/commands/plugins/uninstall.ts)_
|
338 |
|
339 | ## `mycli plugins unlink [PLUGIN]`
|
340 |
|
341 | Removes a plugin from the CLI.
|
342 |
|
343 | ```
|
344 | USAGE
|
345 | $ mycli plugins unlink [PLUGIN...] [-h] [-v]
|
346 |
|
347 | ARGUMENTS
|
348 | PLUGIN... plugin to uninstall
|
349 |
|
350 | FLAGS
|
351 | -h, --help Show CLI help.
|
352 | -v, --verbose
|
353 |
|
354 | DESCRIPTION
|
355 | Removes a plugin from the CLI.
|
356 |
|
357 | ALIASES
|
358 | $ mycli plugins unlink
|
359 | $ mycli plugins remove
|
360 |
|
361 | EXAMPLES
|
362 | $ mycli plugins unlink myplugin
|
363 | ```
|
364 |
|
365 | ## `mycli plugins update`
|
366 |
|
367 | Update installed plugins.
|
368 |
|
369 | ```
|
370 | USAGE
|
371 | $ mycli plugins update [-h] [-v]
|
372 |
|
373 | FLAGS
|
374 | -h, --help Show CLI help.
|
375 | -v, --verbose
|
376 |
|
377 | DESCRIPTION
|
378 | Update installed plugins.
|
379 | ```
|
380 |
|
381 | _See code: [src/commands/plugins/update.ts](https://github.com/oclif/plugin-plugins/blob/v5.4.21/src/commands/plugins/update.ts)_
|
382 |
|
383 |
|
384 | # Contributing
|
385 |
|
386 | See [contributing guide](./CONRTIBUTING.md)
|