listFontsInConfig function

Future<void> listFontsInConfig(
  1. String configFilePath
)

Implementation

Future<void> listFontsInConfig(String configFilePath) async {
  final file = File(configFilePath);
  if (!file.existsSync()) {
    throw ConfigException("Configuration file `$configFilePath` not found.");
  }

  final contents = await file.readAsString();
  final yamlMap = loadYaml(contents) as YamlMap;

  final fonts = List<String>.from(yamlMap['fonts'] ?? []);
  print(AnsiStyles.blueBright.bold('\nFonts in configuration file:'));
  for (int i = 0; i < fonts.length; i++) {
    var font = fonts[i];
    print(AnsiStyles.magentaBright.italic('${i + 1}. $font'));
  }
  print('');
}