[docs]deflist_configs()->List[str]:""" Lists all maestral configs. :returns: A list of all currently existing config files. """configs=[]forfileinos.listdir(get_conf_path("maestral")):iffile.endswith(".ini"):configs.append(os.path.splitext(os.path.basename(file))[0])returnconfigs
[docs]defremove_configuration(config_name:str)->None:""" Removes all config and state files associated with the given configuration. :param config_name: The configuration to remove. """MaestralConfig(config_name).cleanup()MaestralState(config_name).cleanup()data_path=get_data_path("maestral")files=[]forfile_nameinos.listdir(data_path):iffile_name.startswith(config_name):files.append(os.path.join(data_path,file_name))forfileinfiles:try:os.unlink(file)exceptOSError:pass
[docs]defvalidate_config_name(string:_C)->_C:""" Validates that the config name does not contain any whitespace. :param string: String to validate. :returns: The input value. :raises ValueError: if the config name contains whitespace. """iflen(string.split())>1:raiseValueError("Config name may not contain any whitespace")returnstring