( config: CLIConfig, key: string, predicate?: (value: unknown) => boolean, )
| 203 | * This can be used to wipe out default values when something is deleted. |
| 204 | */ |
| 205 | export const resetManagedConfigKey = async ( |
| 206 | config: CLIConfig, |
| 207 | key: string, |
| 208 | predicate?: (value: unknown) => boolean, |
| 209 | ): Promise<void> => { |
| 210 | config.managedProfiles = |
| 211 | Object.fromEntries(Object.entries(config.managedProfiles).map(([profileName, profile]) => { |
| 212 | if (key in profile && (!predicate || predicate(profile[key]))) { |
| 213 | delete profile[key] |
| 214 | } |
| 215 | return [profileName, profile] |
| 216 | })) |
| 217 | |
| 218 | await writeFile(config.managedConfigFilename, buildManagedConfigFileContents(config)) |
| 219 | config.mergedProfiles = mergeProfiles(config.profiles, config.managedProfiles) |
| 220 | } |
| 221 | |
| 222 | /** |
| 223 | * Reset all managed config options for the specified profile. |
no test coverage detected