()
| 25 | } |
| 26 | |
| 27 | async search() { |
| 28 | const plugins = await this.getPlugins() |
| 29 | |
| 30 | // filter out plugins which match the query |
| 31 | const regex = new RegExp(this.options.query) |
| 32 | |
| 33 | const filteredPlugins = plugins.filter( |
| 34 | (plugin) => plugin.name.match(regex) || plugin.description.match(regex), |
| 35 | ) |
| 36 | |
| 37 | // print a message with the search result |
| 38 | const pluginCount = filteredPlugins.length |
| 39 | const query = this.options.query |
| 40 | log.notice(`${pluginCount} plugin(s) found matching "${query}":`) |
| 41 | log.notice() |
| 42 | |
| 43 | await this.display(filteredPlugins) |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | export default PluginSearch |
no test coverage detected