@@ -109,6 +109,12 @@ func main() {
109109 Usage : "run linter" ,
110110 Action : withManager (cmdLint ),
111111 },
112+ {
113+ Name : "authors" ,
114+ Aliases : []string {"a" },
115+ Usage : "list all commit authors" ,
116+ Action : withManager (cmdAuthors ),
117+ },
112118 {
113119 Name : "hooks" ,
114120 Aliases : []string {"h" },
@@ -254,6 +260,43 @@ func cmdLint(ctx context.Context, c *cli.Command, m *repomanager.Manager) error
254260 return nil
255261}
256262
263+ func cmdAuthors (ctx context.Context , c * cli.Command , m * repomanager.Manager ) error {
264+ authors , err := m .GetAuthors ()
265+ if err != nil {
266+ return fmt .Errorf ("cannot get authors: %w" , err )
267+ }
268+
269+ if len (authors ) == 0 {
270+ fmt .Println ("No authors found" )
271+ return nil
272+ }
273+
274+ // Calculate max widths for better formatting
275+ maxNameLen := 0
276+ maxEmailLen := 0
277+ for _ , author := range authors {
278+ if len (author .Name ) > maxNameLen {
279+ maxNameLen = len (author .Name )
280+ }
281+ if len (author .Email ) > maxEmailLen {
282+ maxEmailLen = len (author .Email )
283+ }
284+ }
285+
286+ // Print header
287+ fmt .Printf ("%-*s | %-*s | %s\n " , maxNameLen , "Name" , maxEmailLen , "Email" , "Commits" )
288+ fmt .Printf ("%s-+-%s-+-%s\n " , strings .Repeat ("-" , maxNameLen ), strings .Repeat ("-" , maxEmailLen ), strings .Repeat ("-" , 7 ))
289+
290+ // Print authors
291+ for _ , author := range authors {
292+ fmt .Printf ("%-*s | %-*s | %d\n " , maxNameLen , author .Name , maxEmailLen , author .Email , author .Count )
293+ }
294+
295+ fmt .Printf ("\n Total authors: %d\n " , len (authors ))
296+
297+ return nil
298+ }
299+
257300func cmdHooksList (ctx context.Context , c * cli.Command , m * repomanager.Manager ) error {
258301 fmt .Println ("commit-msg" )
259302
0 commit comments