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AM,CAAC,GAAG,CAAC,CAAC;QAExB,IAAI,GAAG,KAAK,KAAK,EAAE;YACjB,oCAAoC;YACnC,IAAY,CAAC,GAAG,GAAG,IAAI,CAAC;SAC1B;QAED,OAAO,GAAG,GAAG,UAAU,CAAC;KACzB;IAED,IAAI,MAAM,KAAK,OAAO,EAAE;QACtB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACpB,oCAAoC;QACnC,IAAY,CAAC,GAAG,GAAG,IAAI,CAAC;QACzB,OAAO,gBAAgB,CAAC;KACzB;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;SAChC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;SACzD,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,SAAS,KAAK,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;SACjE,IAAI,CAAC,IAAI,CAAC;SACV,IAAI,EAAE,CAAC;AACZ,CAAC;AA7DD,yBA6DC","sources":["webpack://snyk/./src/cli/commands/config.ts"],"sourcesContent":["import * as snyk from '../../lib';\n\nconst validMethods = ['set', 'get', 'unset', 'clear'];\n\nexport default async function config(\n method?: 'set' | 'get' | 'unset' | 'clear',\n ...args: string[]\n): Promise {\n if (method && !validMethods.includes(method)) {\n throw new Error(`Unknown config command \"${method}\"`);\n }\n\n const key = args[0];\n\n if (method === 'set') {\n let res = '';\n\n args.forEach((item) => {\n const [key, val] = item.split(/=(.+)/);\n snyk.config.set(key, val);\n res += key + ' updated\\n';\n\n // ensure we update the live library\n if (key === 'api') {\n (snyk as any).api = val;\n }\n });\n\n return res;\n }\n\n if (method === 'get') {\n if (!key) {\n throw new Error('config:get requires an argument');\n }\n\n return snyk.config.get(key) || '';\n }\n\n if (method === 'unset') {\n if (!key) {\n throw new Error('config:unset requires an argument');\n }\n snyk.config.delete(key);\n\n if (key === 'api') {\n // ensure we update the live library\n (snyk as any).api = null;\n }\n\n return `${key} deleted`;\n }\n\n if (method === 'clear') {\n snyk.config.clear();\n // ensure we update the live library\n (snyk as any).api = null;\n return 'config cleared';\n }\n\n return Object.keys(snyk.config.all)\n .sort((a, b) => Number(a.toLowerCase() < b.toLowerCase()))\n .map((configKey) => `${configKey}: ${snyk.config.all[configKey]}`)\n .join('\\n')\n .trim();\n}\n"],"names":[],"sourceRoot":""}