MCPcopy Index your code
hub / github.com/cloudgraphdev/cli / saveCloudGraphConfigFile

Method saveCloudGraphConfigFile

src/commands/init.ts:159–176  ·  view source on GitHub ↗

* Ensures that the configuration path exists and saves the CloudGraph json config file in it

(configResult: CloudGraphConfig)

Source from the content-addressed store, hash-verified

157 * Ensures that the configuration path exists and saves the CloudGraph json config file in it
158 */
159 saveCloudGraphConfigFile(configResult: CloudGraphConfig): void {
160 const { configDir } = this.config
161 const previousConfig = this.getCGConfig()
162 const newConfig = configResult
163 if (previousConfig) {
164 for (const key of Object.keys(previousConfig)) {
165 if (!configResult[key]) {
166 newConfig[key] = previousConfig[key]
167 }
168 }
169 } else {
170 fileUtils.makeDirIfNotExists(configDir)
171 }
172 fs.writeFileSync(
173 path.join(configDir, '.cloud-graphrc.json'),
174 JSON.stringify(newConfig, null, 2)
175 )
176 }
177
178 async run(): Promise<void> {
179 const { argv } = await this.parse(Init)

Callers 4

runMethod · 0.95
runMethod · 0.80
runMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected