resolveConfigFile static method
Resolves which file the command should read its config from.
A custom configPath (from the --path flag) wins; otherwise
defaultConfigFile is used when present on disk, falling back to
pubspecFile.
When configPath points to the pubspec file, pubspecFile is returned
so that configFile == pubspecFile holds downstream.
Implementation
static File resolveConfigFile({
required String? configPath,
required File pubspecFile,
required File defaultConfigFile,
}) {
if (configPath == pubspecFileName) return pubspecFile;
if (configPath != null) return File(configPath);
if (defaultConfigFile.existsSync()) return defaultConfigFile;
return pubspecFile;
}