File: box_example.go

package info (click to toggle)
golang-github-buger-goterm 0.0%2Bgit20181115.c206103-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 124 kB
  • sloc: makefile: 3
file content (22 lines) | stat: -rw-r--r-- 436 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main

import (
	"fmt"
	tm "github.com/buger/goterm"
)

func main() {
	tm.Clear()

	// Create Box with 30% width of current screen, and height of 20 lines
	box := tm.NewBox(30|tm.PCT, 20, 0)

	// Add some content to the box
	// Note that you can add ANY content, even tables
	fmt.Fprint(box, "Some box content")

	// Move Box to approx center of the screen
	tm.Print(tm.MoveTo(box.String(), 40|tm.PCT, 40|tm.PCT))

	tm.Flush()
}