MCPcopy Index your code
hub / github.com/SmartThingsCommunity/smartthings-cli / resetManagedConfigKey

Function resetManagedConfigKey

src/lib/cli-config.ts:205–220  ·  view source on GitHub ↗
(
		config: CLIConfig,
		key: string,
		predicate?: (value: unknown) => boolean,
)

Source from the content-addressed store, hash-verified

203 * This can be used to wipe out default values when something is deleted.
204 */
205export 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.

Callers 3

handlerFunction · 0.85
selectFromListFunction · 0.85
cli-config.test.tsFile · 0.85

Calls 2

mergeProfilesFunction · 0.85

Tested by

no test coverage detected