()
| 781 | * @returns Result indicating success/failure with count of disabled plugins |
| 782 | */ |
| 783 | export async function disableAllPluginsOp(): Promise<PluginOperationResult> { |
| 784 | const enabledPlugins = getPluginEditableScopes() |
| 785 | |
| 786 | if (enabledPlugins.size === 0) { |
| 787 | return { success: true, message: 'No enabled plugins to disable' } |
| 788 | } |
| 789 | |
| 790 | const disabled: string[] = [] |
| 791 | const errors: string[] = [] |
| 792 | |
| 793 | for (const [pluginId] of enabledPlugins) { |
| 794 | const result = await setPluginEnabledOp(pluginId, false) |
| 795 | if (result.success) { |
| 796 | disabled.push(pluginId) |
| 797 | } else { |
| 798 | errors.push(`${pluginId}: ${result.message}`) |
| 799 | } |
| 800 | } |
| 801 | |
| 802 | if (errors.length > 0) { |
| 803 | return { |
| 804 | success: false, |
| 805 | message: `Disabled ${disabled.length} ${plural(disabled.length, 'plugin')}, ${errors.length} failed:\n${errors.join('\n')}`, |
| 806 | } |
| 807 | } |
| 808 | |
| 809 | return { |
| 810 | success: true, |
| 811 | message: `Disabled ${disabled.length} ${plural(disabled.length, 'plugin')}`, |
| 812 | } |
| 813 | } |
| 814 | |
| 815 | /** |
| 816 | * Update a plugin to the latest version. |
no test coverage detected