def list(self, to_be_listed: str):

    def list_themes():
        themes_dir = self._resource_path('themes')
        themes = [file.name.split('.')[0] for file in themes_dir.iterdir()]
        if (len(themes) < 1):
            log.warn('Cannot list themes, themes directory is empty')
        else:
            log.color_print('Themes:', log.Color.BOLD)
            for theme in themes:
                log.color_print(f'    {theme}', log.Color.BLUE)

    def list_fonts():
        fonts = self._load(self._resource_path('fonts'))
        if ((fonts is None) or ('fonts' not in fonts)):
            log.warn('Cannot list fonts, no fonts found')
        else:
            log.color_print('Fonts:', log.Color.BOLD)
            for font in fonts['fonts']:
                log.color_print(f'    {font}', log.Color.PURPLE)
    options = {'themes': list_themes, 'fonts': list_fonts}
    if (to_be_listed == 'all'):
        for (_, list_function) in options.items():
            list_function()
    else:
        if (to_be_listed not in options):
            raise ConfigError(f'Cannot list {to_be_listed}, unknown option')
        options[to_be_listed]()
def list(self, to_be_listed: str):

    def list_themes():
        themes_dir = self._resource_path('themes')
        themes = [file.name.split('.')[0] for file in themes_dir.iterdir()]
        if (len(themes) < 1):
            log.warn('Cannot list themes, themes directory is empty')
        else:
            log.color_print('Themes:', log.Color.BOLD)
            for theme in themes:
                log.color_print(f'    {theme}', log.Color.BLUE)

    def list_fonts():
        fonts = self._load(self._resource_path('fonts'))
        if ((fonts is None) or ('fonts' not in fonts)):
            log.warn('Cannot list fonts, no fonts found')
        else:
            log.color_print('Fonts:', log.Color.BOLD)
            for font in fonts['fonts']:
                log.color_print(f'    {font}', log.Color.PURPLE)
    options = {'themes': list_themes, 'fonts': list_fonts}
    if (to_be_listed == 'all'):
        for (_, list_function) in options.items():
            list_function()
    else:
        if (to_be_listed not in options):
            raise ConfigError(f'Cannot list {to_be_listed}, unknown option')
        options[to_be_listed]()