-
Notifications
You must be signed in to change notification settings - Fork 22
/
link.ts
34 lines (25 loc) · 1.16 KB
/
link.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import {Command, flags} from '@oclif/command'
import chalk from 'chalk'
import cli from 'cli-ux'
import Plugins from '../../plugins'
export default class PluginsLink extends Command {
static description = `links a plugin into the CLI for development
Installation of a linked plugin will override a user-installed or core plugin.
e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello' command will override the user-installed or core plugin implementation. This is useful for development work.
`
static usage = 'plugins:link PLUGIN'
static examples = ['$ <%= config.bin %> plugins:link <%- config.pjson.oclif.examplePlugin || "myplugin" %> ']
static args = [{name: 'path', description: 'path to plugin', required: true, default: '.'}]
static flags = {
help: flags.help({char: 'h'}),
verbose: flags.boolean({char: 'v'}),
}
plugins = new Plugins(this.config)
async run() {
const {flags, args} = this.parse(PluginsLink)
this.plugins.verbose = flags.verbose
cli.action.start(`Linking plugin ${chalk.cyan(args.path)}`)
await this.plugins.link(args.path)
cli.action.stop()
}
}