in modular_cli/service/config.py [0:0]
def add_data_to_config(name: str, value: str):
# todo loading and dumping yaml for the sake of one value - not worth it.
# todo I want to add data to config, but config does not exists and
# i get error - silly
config_file_path = get_credentials_folder() / CREDENTIALS_FILE_NAME
if not Path(config_file_path).exists():
SYSTEM_LOG.exception(f'Modular-CLI tool is not configured. Please '
f'contact the support team.')
return 'Modular-CLI tool is not configured. Please contact the ' \
'support team.'
with open(config_file_path, 'r') as config_file:
config = yaml.safe_load(config_file.read())
config[name] = value
with open(config_file_path, 'w') as config_file:
yaml.dump(config, config_file)