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