summaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorChristian Muehlhaeuser <muesli@gmail.com>2019-12-07 19:49:24 +0100
committerChristian Muehlhaeuser <muesli@gmail.com>2019-12-07 19:49:24 +0100
commitc31c06a79319a0b0ded09d6ada3975462e38ea67 (patch)
tree0d69bda9fb486534e2cef2b30d143e632c1782a6 /main.go
parent58c97dc8dbfb7d05fdacbf3ef528499be672d350 (diff)
Calculate block width from BlockStack & RenderContext
Diffstat (limited to 'main.go')
-rw-r--r--main.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/main.go b/main.go
index 5de6667..a02f017 100644
--- a/main.go
+++ b/main.go
@@ -110,18 +110,19 @@ func execute(cmd *cobra.Command, args []string) error {
!cmd.Flags().Changed("style") {
style = "notty"
}
- r, err := gold.NewTermRenderer(style)
- if err != nil {
- return err
- }
- r.WordWrap = int(width)
u, err := url.ParseRequestURI(src.URL)
if err == nil {
u.Path = filepath.Dir(u.Path)
- r.BaseURL = u.String() + "/"
}
+ r, err := gold.NewTermRenderer(style, gold.Options{
+ BaseURL: u.String() + "/",
+ WordWrap: int(width),
+ })
+ if err != nil {
+ return err
+ }
out := r.RenderBytes(b)
fmt.Printf("%s", string(out))
return nil