execute method
Future<void>
execute(
)
override
Implementation
@override
Future<void> execute() async {
Branch? branch = repository.state.getCurrentBranch(
onNoStateFile: () => debugPrintToConsole(
message: "No state file",
style: CliStyle.bold,
color: CliColor.red,
),
);
if (branch == null) {
printToConsole(
message: "Failed to get current branch",
style: CliStyle.bold,
color: CliColor.red,
);
return;
}
late final Staging staging = Staging(branch);
if (!staging.hasStagedFiles) {
printToConsole(
message: "Files not staged",
style: CliStyle.bold,
color: CliColor.red,
);
return;
}
await Isolate.run(
() async {
staging.commitStagedFiles(
message: message,
onNoStagingData: () => debugPrintToConsole(
message: "Files not staged",
style: CliStyle.bold,
color: CliColor.red,
),
);
},
);
}