initialize method
Implementation
@override
List<UndoableCommand> initialize() {
Repository repository = Repository(Directory.current.path);
debugPrintToConsole(message: "Repository path is ${repository.path}");
String? branch = branchName;
if (branch == null) {
debugPrintToConsole(
message: "Branch not provided. Switching to current branch",
);
}
branch ??= repository.state
.getCurrentBranch(
onNoStateFile: () => debugPrintToConsole(
message: "No state file provided",
),
)
?.branchName;
if (branch == null) {
debugPrintToConsole(
message: "Failed to get current branch",
);
return [ShowErrorCommand("Provide a branch name")];
}
return [
GetBranchCommitHistoryCommand(repository, branch),
];
}