+sub _command_projects {
+ my $self = shift;
+ my $opts = shift;
+
+ my $toplevel = git_toplevel('.') or die "Not a git repo\n";
+
+ my $codeowners_path = find_codeowners_in_directory($toplevel)
+ or die "No CODEOWNERS file in $toplevel\n";
+ my $codeowners = File::Codeowners->parse_from_filepath($codeowners_path);
+
+ my $results = $codeowners->projects;
+
+ my $formatter = App::Codeowners::Formatter->new(
+ format => $opts->{format} || '%P',
+ handle => *STDOUT,
+ columns => [qw(Project)],
+ );
+ $formatter->add_result(map { [$_] } @$results);
+}
+