Skip to content

Commit

Permalink
feat: add plugins reset cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Nov 1, 2023
1 parent 17afd99 commit 6d5d4a2
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/commands/plugins/reset.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {Command} from '@oclif/core'
import chalk from 'chalk'

import Plugins from '../../plugins.js'

export default class Reset extends Command {
static summary = 'Remove all user-installed and linked plugins.'

async run(): Promise<void> {
const plugins = new Plugins(this.config)
const userPlugins = await plugins.list()

this.log(`Uninstalling ${userPlugins.length} plugin${userPlugins.length === 0 ? '' : 's'}`)
for (const plugin of userPlugins) {
this.log(`• ${plugin.name} ${chalk.dim(`(${plugin.type})`)}`)
}

await Promise.all(userPlugins.map(async (plugin) => plugins.uninstall(plugin.name)))
}
}

0 comments on commit 6d5d4a2

Please sign in to comment.