get method

  1. @cliCommand
Future<void> get(
  1. String key
)

Get a configuration value by key

Implementation

@cliCommand
Future<void> get(
  /// Configuration key (e.g., app_name, version)
  String key,
) async {
  info("Reading configuration key: $key");

  final configFile = File(configPath);

  if (!configFile.existsSync()) {
    error("Configuration not found. Run 'claudio config init' first.");
    return;
  }

  final content = await configFile.readAsString();
  final yaml = loadYaml(content);

  if (yaml is! Map) {
    error("Invalid configuration format");
    return;
  }

  final value = yaml[key];

  if (value == null) {
    warn("Key '$key' not found in configuration");
    return;
  }

  print('$key: $value');
  success("Retrieved configuration value");
}