ensureConfigFilePath sets a default config file path if none is provided and creates the config directory.
(input *aculConfigInput, cli *cli)
| 186 | |
| 187 | // ensureConfigFilePath sets a default config file path if none is provided and creates the config directory. |
| 188 | func ensureConfigFilePath(input *aculConfigInput, cli *cli) error { |
| 189 | if input.filePath == "" { |
| 190 | input.filePath = fmt.Sprintf("acul_config/%s.json", input.screenName) |
| 191 | cli.renderer.Warnf("No configuration file path specified. Defaulting to '%s'.", ansi.Green(input.filePath)) |
| 192 | } |
| 193 | if err := os.MkdirAll("acul_config", 0755); err != nil { |
| 194 | return fmt.Errorf("could not create config directory: %w", err) |
| 195 | } |
| 196 | return nil |
| 197 | } |
| 198 | |
| 199 | // Generate default ACUL config stub. |
| 200 | func defaultACULConfig() map[string]interface{} { |
no test coverage detected