change to hyperlinks
ci/woodpecker/push/goreleaser Pipeline was successful Details
ci/woodpecker/tag/goreleaser Pipeline was successful Details

Signed-off-by: jolheiser <john.olheiser@gmail.com>
main v0.0.2
jolheiser 2022-10-25 15:58:22 -05:00
parent 480035417b
commit 41648a142f
Signed by: jolheiser
GPG Key ID: B853ADA5DA7BBF7A
2 changed files with 8 additions and 7 deletions

10
main.go
View File

@ -34,14 +34,14 @@ func main() {
if err != nil { if err != nil {
log.WithError(err).Fatal("could not get trending repositories") log.WithError(err).Fatal("could not get trending repositories")
} }
log.Styles[log.InfoLevel] = lipgloss.NewStyle().Foreground(lipgloss.Color(l.color)).Bold(true) log.Styles[log.InfoLevel] = lipgloss.NewStyle().Foreground(lipgloss.Color(l.Color)).Bold(true)
log.Info(lang.Name) log.Info(lang.Name)
log.IncreasePadding() log.IncreasePadding()
for _, repo := range l.repositories { for _, repo := range l.Repositories {
log.WithField("link", repo.link()).Info(repo.name) log.Info(repo.Link())
if repo.description != "" { if repo.Description != "" {
log.IncreasePadding() log.IncreasePadding()
log.Info(repo.description) log.Info(repo.Description)
log.DecreasePadding() log.DecreasePadding()
} }
} }

View File

@ -6,6 +6,7 @@ import (
"strings" "strings"
"github.com/PuerkitoBio/goquery" "github.com/PuerkitoBio/goquery"
"github.com/muesli/termenv"
) )
func trendingLang(lang string, timeframes []string) (Language, error) { func trendingLang(lang string, timeframes []string) (Language, error) {
@ -69,6 +70,6 @@ type Repository struct {
Description string `json:"description"` Description string `json:"description"`
} }
func (r Repository) link() string { func (r Repository) Link() string {
return fmt.Sprintf("https://github.com/%s", r.Name) return termenv.Hyperlink(fmt.Sprintf("https://github.com/%s", r.Name), r.Name)
} }