Skip to content

Commit

Permalink
fix printing
Browse files Browse the repository at this point in the history
  • Loading branch information
azimut committed Jul 27, 2022
1 parent c48f0ad commit 0b39224
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/hackerview/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func init() {
flag.StringVar(&opt.userAgent, "A", "Wget", "default User-Agent sent")
flag.BoolVar(&opt.useColors, "C", true, "use colors")
flag.BoolVar(&opt.usePretty, "P", true, "use pretty formatting")
flag.IntVar(&opt.width, "w", 0, "fixed with, defaults to console width")
flag.IntVar(&opt.width, "w", 80, "fixed with")
}

func usage() {
Expand Down
10 changes: 8 additions & 2 deletions internal/hackernews/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func Format(width int, op *Op, comments *[]Comment) {
max_width = width
fmt.Println(op)
for _, comment := range *comments {
fmt.Println(comment)
fmt.Println(&comment)
}
}

Expand All @@ -34,7 +34,13 @@ func (o *Op) String() (ret string) {
ret += "url: " + o.url + "\n"
}
ret += "self: " + o.selfUrl + "\n"
ret += fmt.Sprintf("%s(%d) - %s\n", o.user, o.score, humanize.Time(o.date))
ret += fmt.Sprintf(
"%s(%d) - %s - %d Comments\n",
o.user,
o.score,
humanize.Time(o.date),
o.ncomments,
)
return
}

Expand Down

0 comments on commit 0b39224

Please sign in to comment.