findRepository function

  1. @Deprecated('Use SidekickContext.repository or SidekickContext.projectRoot')
Repository findRepository()

Finds the root of the repo

Deprecated because sidekick doesn't require a git repo anymore. This method will work most of the time, but git is not a requirement anymore. Thus, people will use sidekick CLIs outside of a git repository

Implementation

@Deprecated('Use SidekickContext.repository or SidekickContext.projectRoot')
Repository findRepository() {
  final dir = SidekickContext.repository;
  if (dir == null) {
    throw 'Could not find the root of the repository from ${SidekickContext.projectRoot.path}';
  }
  return Repository(root: dir);
}