Skip to content

Commit

Permalink
aat-frontend: add option for monochrome output
Browse files Browse the repository at this point in the history
  • Loading branch information
schachmat committed Apr 24, 2016
1 parent a033b47 commit 5cc44e5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions frontends/ascii-art-table.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"log"
"math"
"os"
"regexp"
"strings"
"time"
Expand All @@ -15,8 +16,9 @@ import (
)

type aatConfig struct {
coords bool
unit iface.UnitSystem
coords bool
monochrome bool
unit iface.UnitSystem
}

//TODO: replace s parameter with printf interface?
Expand Down Expand Up @@ -365,14 +367,18 @@ func (c *aatConfig) printDay(day iface.Day) (ret []string) {
}

func (c *aatConfig) Setup() {
flag.BoolVar(&c.coords, "aat-coords", false, "Show geo coordinates")
flag.BoolVar(&c.coords, "aat-coords", false, "aat-frontend: Show geo coordinates")
flag.BoolVar(&c.monochrome, "aat-monochrome", false, "aat-frontend: Monochrome output")
}

func (c *aatConfig) Render(r iface.Data, unitSystem iface.UnitSystem) {
c.unit = unitSystem

fmt.Printf("Weather for %s%s\n\n", r.Location, c.formatGeo(r.GeoLoc))
stdout := colorable.NewColorableStdout()
if c.monochrome {
stdout = colorable.NewNonColorable(os.Stdout)
}

out := c.formatCond(make([]string, 5), r.Current, true)
for _, val := range out {
Expand Down

0 comments on commit 5cc44e5

Please sign in to comment.