Update config variables in place with user-provided values.
(config: ConfigParser,
profile: str,
prompts: dict[str, dict[str, str]])
| 222 | |
| 223 | |
| 224 | def _input_config_variables(config: ConfigParser, |
| 225 | profile: str, |
| 226 | prompts: dict[str, dict[str, str]]) -> ConfigParser: |
| 227 | """Update config variables in place with user-provided values.""" |
| 228 | |
| 229 | for var, prompt in prompts.items(): |
| 230 | default_val = config.get(profile, var, fallback=None) |
| 231 | prompt.setdefault('default', default_val) |
| 232 | val = default_text_input(**prompt) |
| 233 | if val: |
| 234 | val = os.path.expandvars(val) |
| 235 | if val and val != default_val: |
| 236 | config.set(profile, var, val) |
| 237 | return config |
| 238 | |
| 239 | def _load_config(config_file: str) -> ConfigParser: |
| 240 | """Load from config_file, or create new with defaults.""" |
no test coverage detected