initialize method

  1. @override
List<UndoableCommand> initialize()
override

Implementation

@override
List<UndoableCommand> initialize() {
  if (path == null) {
    debugPrintToConsole(message: "Path not provided");
    return [ShowErrorCommand("Path required")];
  }

  // Initialize the repository
  Repository repository = Repository(path!);
  Branch branch = Branch(defaultBranch, repository);

  // Return the list of commands
  return [
    InitializeRepositoryCommand(repository),
    CreateIgnoreFileCommand(repository),
    ...defaultIgnore.map((p) => AddIgnorePatternCommand(repository, p)),
    CreateNewBranchCommand(repository, branch),
    CreateStateFileCommand(repository, branch),
  ];
}