isReserved static method
Implementation
static Future<bool> isReserved(String name, {Set<String>? excludeFromGenerated}) async {
if (isCached(name)) return true;
final reserved = await _systemCheck(name);
final generatedExecutables = _generatedExecutables();
// Temporarily exclude commands being checked from generated list to detect conflicts
if (excludeFromGenerated != null) {
generatedExecutables.removeAll(excludeFromGenerated);
}
final binExecutables = <String>{};
if (pubCacheBin.existsSync()) {
for (final f in pubCacheBin.listSync()) {
if (f is File) {
final baseName = f.uri.pathSegments.last.split('.').first;
if (!generatedExecutables.contains(baseName)) {
binExecutables.add(baseName);
}
}
}
}
// Also exclude commands being checked from bin executables check
if (excludeFromGenerated != null) {
binExecutables.removeAll(excludeFromGenerated);
}
final isReservedFinal = reserved || binExecutables.contains(name);
if (isReservedFinal) add(name);
return isReservedFinal;
}