in bonsaicli2/bonsai_cli/config.py [0:0]
def update(self, **kwargs: Any):
"""
Updates the configuration with the Key/value pairs in kwargs and
writes to the .bonsaiconfig file in the users home directory.
"""
if not kwargs:
return False
for key, value in kwargs.items():
if key.lower() == _PROFILE.lower():
self._set_profile(value)
else:
try:
self._config_parser.set(self.profile, key, str(value))
except NoSectionError:
# Create and set default profile if it does not exist in .bonsaiconfig
self._set_profile(self.profile)
self._config_parser.set(self.profile, key, str(value))
if not self._write_dot_bonsaiconfig():
return False
self._parse_config(self.profile)
return True