File: tui.go

package info (click to toggle)
golang-github-evilsocket-islazy 1.11.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 292 kB
  • sloc: javascript: 8; makefile: 3
file content (37 lines) | stat: -rw-r--r-- 581 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main

import (
	"fmt"
	"os"

	"github.com/evilsocket/islazy/tui"
)

func main() {
	if !tui.Effects() {
		fmt.Printf("tui effects not available on this terminal.\n")
		return
	}

	// ASCII tables on the terminal
	columns := []string{
		"City",
		"Temp",
	}

	rows := [][]string{
		{"Roma", "16 C"},
		{"Milano", "17 C"},
		{"Firenze", "15 C"},
	}

	tui.Table(os.Stdout, columns, rows)

	err := fmt.Errorf("example error")
	// and colors :)
	if err != nil {
		fmt.Printf("\nERROR: %s\n", tui.Bold(tui.Red(err.Error())))
	} else {
		fmt.Printf("\n%s\n", tui.Green("Ok"))
	}
}