-
Notifications
You must be signed in to change notification settings - Fork 1
/
fitlist.go
72 lines (64 loc) · 1.37 KB
/
fitlist.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package main
import (
"github.com/ajstarks/deck/generate"
"os"
)
func fit(deck *generate.Deck, top, bottom, left, textsize float64, color string, list []string, doline bool) {
x := left
y := top
var spacing float64
for {
spacing = (top - bottom) / float64(len(list)-1)
if spacing > textsize {
break
}
textsize -= 2.0
}
for _, s := range list {
deck.Text(x, y, s, "sans", textsize, color)
if doline {
deck.Line(x, y-spacing/3, 100-x+5, y-spacing/3, 0.1, "")
}
y -= spacing
}
}
func main() {
cmd := []string{
"build",
"clean",
"env",
"fix",
"fmt",
"generate",
"get",
"install",
"list",
"run",
"test",
"tool",
"version",
"vet"}
desc := []string{
"compile packages and dependencies",
"remove object files",
"print Go environment information",
"run go tool fix on packages",
"run gofmt on package sources",
"generate Go files by processing source",
"download and install packages and dependencies",
"compile and install packages and dependencies",
"list packages",
"compile and run Go program",
"test packages",
"run specified go tool",
"print Go version",
"run go tool vet on packages",
}
deck := generate.NewSlides(os.Stdout, 1024, 768)
deck.StartDeck()
deck.StartSlide()
fit(deck, 95, 5, 15, 2.5, "black", cmd, true)
fit(deck, 95, 5, 30, 2.5, "gray", desc, false)
deck.EndSlide()
deck.EndDeck()
}