configPath property

String get configPath

The configuration file this command should read.

A sub-command's own --config wins, but only when it was actually typed: its default would otherwise shadow the global --config on every invocation, which silently made the documented global option do nothing.

Implementation

String get configPath {
  final local = argResults;
  if (local != null &&
      local.options.contains('config') &&
      local.wasParsed('config')) {
    return local['config'] as String;
  }
  return (globalResults?['config'] as String?) ?? 'distribution.yaml';
}