Readd explicit error handling to examples

This commit is contained in:
Caleb Bassi 2018-09-06 18:22:04 -07:00
parent f4dc75130f
commit 00d684343a
15 changed files with 60 additions and 15 deletions

View File

@ -9,7 +9,10 @@ package main
import ui "github.com/gizak/termui"
func main() {
ui.Init()
err := ui.Init()
if err != nil {
panic(err)
}
defer ui.Close()
bc := ui.NewBarChart()

View File

@ -14,7 +14,10 @@ import (
)
func main() {
ui.Init()
err := ui.Init()
if err != nil {
panic(err)
}
defer ui.Close()
p := ui.NewPar(":PRESS q TO QUIT DEMO")

View File

@ -9,7 +9,10 @@ package main
import ui "github.com/gizak/termui"
func main() {
ui.Init()
err := ui.Init()
if err != nil {
panic(err)
}
defer ui.Close()
g0 := ui.NewGauge()

View File

@ -14,7 +14,10 @@ import (
)
func main() {
ui.Init()
err := ui.Init()
if err != nil {
panic(err)
}
defer ui.Close()
sinps := (func() []float64 {

View File

@ -13,7 +13,10 @@ import (
)
func main() {
ui.Init()
err := ui.Init()
if err != nil {
panic(err)
}
defer ui.Close()
sinps := (func() map[string][]float64 {

View File

@ -9,7 +9,10 @@ package main
import ui "github.com/gizak/termui"
func main() {
ui.Init()
err := ui.Init()
if err != nil {
panic(err)
}
defer ui.Close()
strs := []string{

View File

@ -9,7 +9,10 @@ package main
import ui "github.com/gizak/termui"
func main() {
ui.Init()
err := ui.Init()
if err != nil {
panic(err)
}
defer ui.Close()
bc := ui.NewMBarChart()

View File

@ -9,7 +9,10 @@ package main
import ui "github.com/gizak/termui"
func main() {
ui.Init()
err := ui.Init()
if err != nil {
panic(err)
}
defer ui.Close()
par0 := ui.NewPar("Borderless Text")

View File

@ -12,7 +12,10 @@ import (
)
func main() {
ui.Init()
err := ui.Init()
if err != nil {
panic(err)
}
defer ui.Close()
rand.Seed(time.Now().UTC().UnixNano())

View File

@ -9,7 +9,10 @@ package main
import ui "github.com/gizak/termui"
func main() {
ui.Init()
err := ui.Init()
if err != nil {
panic(err)
}
defer ui.Close()
data := []int{4, 2, 1, 6, 3, 9, 1, 4, 2, 15, 14, 9, 8, 6, 10, 13, 15, 12, 10, 5, 3, 6, 1, 7, 10, 10, 14, 13, 6}

View File

@ -9,7 +9,10 @@ package main
import ui "github.com/gizak/termui"
func main() {
ui.Init()
err := ui.Init()
if err != nil {
panic(err)
}
defer ui.Close()
rows1 := [][]string{

View File

@ -12,7 +12,10 @@ import (
)
func main() {
ui.Init()
err := ui.Init()
if err != nil {
panic(err)
}
defer ui.Close()
header := ui.NewPar("Press q to quit, Press j or k to switch tabs")

View File

@ -14,7 +14,10 @@ import (
)
func main() {
ui.Init()
err := ui.Init()
if err != nil {
panic(err)
}
defer ui.Close()
// Deprecated

View File

@ -276,7 +276,10 @@ func main() {
if runtime.GOOS != "linux" {
panic("Currently works only on Linux")
}
ui.Init()
err := ui.Init()
if err != nil {
panic(err)
}
defer ui.Close()
termWidth := 70

View File

@ -9,7 +9,10 @@ package main
import ui "github.com/gizak/termui"
func main() {
ui.Init()
err := ui.Init()
if err != nil {
panic(err)
}
defer ui.Close()
p := ui.NewPar("Press q to QUIT THE DEMO. [There](fg-blue) are other things [that](fg-red) are going to fit in here I think. What do you think? Now is the time for all good [men to](bg-blue) come to the aid of their country. [This is going to be one really really really long line](fg-green) that is going to go together and stuffs and things. Let's see how this thing renders out.\n Here is a new paragraph and stuffs and things. There should be a tab indent at the beginning of the paragraph. Let's see if that worked as well.")