* Ensures that the configuration path exists and saves the CloudGraph json config file in it
(configResult: CloudGraphConfig)
| 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) |
no outgoing calls
no test coverage detected