completionSpec top-level property
Implementation
final completionSpec = FigSpec(
name: "heroku",
generateSpec:
(List<String> tokens, ExecuteCommandFunction executeShellCommand,
[FigGeneratorContext? context]) async {
try {
final version = await getVersionCommand(executeShellCommand);
final parts = version.split('.');
if (parts.length >= 2) {
final major = int.tryParse(parts[0]) ?? 0;
final minor = int.tryParse(parts[1]) ?? 0;
// If version is >= 8.6.0, use v8_6_0 spec
if (major > 8 || (major == 8 && minor >= 6)) {
return v8_6_0.herokuSpec;
}
}
// Default to 8.0.0 for older versions or parse failures
return v8_0_0.herokuSpec;
} catch (_) {
// Command not found or execution failed: use latest spec
return v8_6_0.herokuSpec;
}
},
);