-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Brandon Jordan edited this page Sep 24, 2022
·
8 revisions
Install
go get github.com/electrikmilk/ttuy
Import
import "github.com/electrikmilk/ttuy"
var name string
ttuy.Ask("Enter your name", &name)
if ttuy.Prompt("Install Program? This will take up 586kb.") {
fmt.Println("Installing...")
} else {
fmt.Println("Installation Canceled.")
}
ttuy.YesNo("Are you sure?")
ttuy.Style("Text", ttuy.Bold, ttuy.Green) // returns string
ttuy.Menu("Title", []ttuy.Option{
{
Label: "Option 1",
Callback: func() {
// ...
},
},
{
Label: "Option 2",
Callback: func() {
// ...
},
Disabled: true,
},
// ...
})
var headers = []string{"Header 1", "Header 2", "Header 3", "Header 4"}
var rows []ttuy.row
for i := 0; i < 5; i++ {
var rowRows = []string{"Cell 1", "Cell 2", "Cell 3", "Cell 4"}
rows = append(rows, ttuy.row{columns: rowRows})
}
ttuy.Table(headers, rows)
for i := 0; i <= 100; i++ {
ttuy.Progress(i)
time.Sleep(100 * time.Millisecond)
}
ttuy.Typewriter("Typed out one character at a time")
Or time it specifically...
ttuy.TypewriterTimed("Typed out at duration...", 1000)
Print contents of file, some ASCII art for example...
ttuy.File("logo.txt")