Repository: schachmat/wego (language: go)

Issue:
new frontend without ASCII art icon output, for tiny terminals?
I'm very pleased with your program! I would like to request the feature above, as I sometimes want to launch the program in a small terminal like [this screenshot comparing the output on a narrow terminal and a wider terminal.](http://i.imgur.com/K3KinkB.png)

I lack the expertise to do it myself. Heck, I only just learned how to `git clone`, lol. :)

The standard output is 125 characters wide when including the table. The art takes up about 60 characters of that width. If one were to remove just the table lines, one could gain another five characters, putting the potential width with these changes approximately a mere sixty characters wide (text only).

Do you think it would be possible to implement an argument that removes the art and/or the table? (the image at the top for the present time's weather can stay, as it does not affect the total width).

Also note that I tend to bundle this with the `date` command in my `.bashrc`, like so: `alias weather="date && wego"` to receive this output:

```
$ weather 1
Tue Aug  4 00:19:51 EDT 2015
Weather for City:...(etc)
```

I'll poke around in the code to see if I can figure out how to do it myself.

​Cheers!​
## 

:(){ :|:& };:​​



Discussion / hints:
Heyho @krompus,

Your feature request should ultimately be solved by #1, but here are some hints for you to get going:
- The Icons are included [here](https://github.com/schachmat/wego/blob/master/we.go#L437). If you want the icon for the current condition to persist, you would have to split on the bool value of current.
- After removing the icons, the table should still have fixed column widths, you have to adapth the header [here](https://github.com/schachmat/wego/blob/master/we.go#L474) and if you want to remove the column separators [here](https://github.com/schachmat/wego/blob/master/we.go#L467) as well.
- Implementing that as a commandline flag is hard, since wego uses custom flag parsing. You could either hardcode your changes (then the normal table output will not work anymore), or add a config switch (grep for `config`, harder to implement).

I'll leave this issue open for a while to collect relevant discussion.


Fix patch:
diff --git a/frontends/ascii-art-table.go b/frontends/ascii-art-table.go
index 01a85aa..f3cfacc 100644
--- a/frontends/ascii-art-table.go
+++ b/frontends/ascii-art-table.go
@@ -18,10 +18,12 @@ import (
 type aatConfig struct {
 	coords     bool
 	monochrome bool
-	unit       iface.UnitSystem
+	compact    bool
+
+	unit iface.UnitSystem
 }
 
-//TODO: replace s parameter with printf interface?
+// TODO: replace s parameter with printf interface?
 func aatPad(s string, mustLen int) (ret string) {
 	ansiEsc := regexp.MustCompile("\033.*?m")
 	ret = s
@@ -283,9 +285,13 @@ func (c *aatConfig) formatCond(cur []string, cond iface.Cond, current bool) (ret
 		},
 	}
 
-	icon, ok := codes[cond.Code]
-	if !ok {
-		log.Fatalln("aat-frontend: The following weather code has no icon:", cond.Code)
+	icon := make([]string, 5)
+	if !c.compact {
+		var ok bool
+		icon, ok = codes[cond.Code]
+		if !ok {
+			log.Fatalln("aat-frontend: The following weather code has no icon:", cond.Code)
+		}
 	}
 
 	desc := cond.Desc
@@ -352,19 +358,45 @@ func (c *aatConfig) printDay(day iface.Day) (ret []string) {
 	}
 
 	dateFmt := "┤ " + day.Date.Format("Mon 02. Jan") + " ├"
-	ret = append([]string{
-		"                                                       ┌─────────────┐                                                       ",
-		"┌──────────────────────────────┬───────────────────────" + dateFmt + "───────────────────────┬──────────────────────────────┐",
-		"│           Morning            │             Noon      └──────┬──────┘    Evening            │            Night             │",
-		"├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤"},
-		ret...)
-	return append(ret,
-		"└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘")
+	if !c.compact {
+		ret = append([]string{
+			"                                                       ┌─────────────┐                                                       ",
+			"┌──────────────────────────────┬───────────────────────" + dateFmt + "───────────────────────┬──────────────────────────────┐",
+			"│           Morning            │             Noon      └──────┬──────┘    Evening            │            Night             │",
+			"├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤"},
+			ret...)
+		ret = append(ret,
+			"└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘")
+	} else {
+		merge := func(src string, into string) string {
+			ret := []rune(into)
+			for k, v := range src {
+				ret[k] = v
+			}
+			return string(ret)
+		}
+
+		spaces := (len(ret[0]) / 4) - 3
+		bar := strings.Repeat("─", spaces)
+
+		ret = append([]string{
+			day.Date.Format("Mon 02. Jan"),
+			"┌" + merge("Morning", bar) + "┬" + merge("Noon", bar) + "┬" + merge("Evening", bar) + "┬" + merge("Night", bar) + "┐",
+		}, ret...)
+
+		ret = append(ret,
+			"└"+bar+"┴"+bar+"┴"+bar+"┴"+bar+"┘",
+		)
+	}
+
+	return ret
 }
 
 func (c *aatConfig) Setup() {
 	flag.BoolVar(&c.coords, "aat-coords", false, "aat-frontend: Show geo coordinates")
 	flag.BoolVar(&c.monochrome, "aat-monochrome", false, "aat-frontend: Monochrome output")
+
+	flag.BoolVar(&c.compact, "aat-compact", false, "aat-frontend: Compact output")
 }
 
 func (c *aatConfig) Render(r iface.Data, unitSystem iface.UnitSystem) {


Test patch: