@@ -15,9 +15,10 @@ import (
1515 "github.com/lauripiispanen/most-active-github-users-counter/top"
1616)
1717
18- type Format func (users GithubUserList , writer io.Writer , options top.Options ) error
18+ type Format func (results github. GithubSearchResults , writer io.Writer , options top.Options ) error
1919
20- func PlainOutput (users GithubUserList , writer io.Writer , options top.Options ) error {
20+ func PlainOutput (results github.GithubSearchResults , writer io.Writer , options top.Options ) error {
21+ users := GithubUserList (results .Users )
2122 fmt .Fprintln (writer , "USERS\n --------" )
2223 for i , user := range users {
2324 fmt .Fprintf (writer , "#%+v: %+v (%+v):%+v (%+v) %+v\n " , i + 1 , user .Name , user .Login , user .ContributionCount , user .Company , strings .Join (user .Organizations , "," ))
@@ -29,7 +30,8 @@ func PlainOutput(users GithubUserList, writer io.Writer, options top.Options) er
2930 return nil
3031}
3132
32- func CsvOutput (users GithubUserList , writer io.Writer , options top.Options ) error {
33+ func CsvOutput (results github.GithubSearchResults , writer io.Writer , options top.Options ) error {
34+ users := GithubUserList (results .Users )
3335 w := csv .NewWriter (writer )
3436 if err := w .Write ([]string {"rank" , "name" , "login" , "contributions" , "company" , "organizations" }); err != nil {
3537 return err
@@ -49,7 +51,8 @@ func CsvOutput(users GithubUserList, writer io.Writer, options top.Options) erro
4951 return nil
5052}
5153
52- func YamlOutput (users GithubUserList , writer io.Writer , options top.Options ) error {
54+ func YamlOutput (results github.GithubSearchResults , writer io.Writer , options top.Options ) error {
55+ users := GithubUserList (results .Users )
5356 outputUsers := func (user []github.User , public_only bool ) {
5457 for i , u := range user {
5558 contributionCount := u .ContributionCount
@@ -106,7 +109,8 @@ func YamlOutput(users GithubUserList, writer io.Writer, options top.Options) err
106109 outputOrganizations (topPrivate .TopOrgs (10 ))
107110
108111 fmt .Fprintf (writer , "generated: %+v\n " , time .Now ())
109- fmt .Fprintf (writer , "min_followers_required: %+v\n " , users .MinFollowers ())
112+ fmt .Fprintf (writer , "min_followers_required: %+v\n " , results .MinimumFollowerCount )
113+ fmt .Fprintf (writer , "total_user_count: %+v\n " , results .TotalUserCount )
110114
111115 return nil
112116}
0 commit comments