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