-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
51 lines (51 loc) · 1.31 KB
/
doc.go
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Blox is a Go package to block-paste text in a character raster buffer. Text
// is pasted and positioned via X/Y coordinates on a canvas which can be printed
// as-is or delimited by line breaks at column-width. Trailing spaces and
// trailing empty lines can be trimmed from the output and/or before printing
// the canvas.
//
// The example below illustrates basic usage. See the PutText functions
// for more examples.
//
// package main
//
// import (
// "fmt"
//
// "github.com/sa6mwa/blox"
// )
//
// func main() {
// b := blox.New().Trim().SetColumnsAndRows(80, 24)
//
// text := "ABCDE FGHIJ KLMNO" + blox.LineBreak
// text += "PQRST UVWXY ZABCD" + blox.LineBreak
//
// heading := "CRYPTO" + blox.LineBreak
// heading += "GROUPS"
//
// str := b.PutText(heading).DrawHorizontalLine(0, 6).DrawVerticalLine(0, 1, ':').
// PutChar('+').MoveDown().MoveX(0).PutText(text).
// Move(9, 0).PutText(text).Join(blox.LineBreak)
//
// strEndingInNewLine := b.String()
//
// fmt.Println(str)
// fmt.Println("--")
// fmt.Print(strEndingInNewLine)
// }
//
// Output
//
// CRYPTO : ABCDE FGHIJ KLMNO
// GROUPS : PQRST UVWXY ZABCD
// -------+
// ABCDE FGHIJ KLMNO
// PQRST UVWXY ZABCD
// --
// CRYPTO : ABCDE FGHIJ KLMNO
// GROUPS : PQRST UVWXY ZABCD
// -------+
// ABCDE FGHIJ KLMNO
// PQRST UVWXY ZABCD
package blox