-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeprecated.go
100 lines (86 loc) · 1.98 KB
/
deprecated.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package box
import (
"context"
"io"
)
// Deprecated:
type BoxT = Box
// Deprecated:
func New() *Box {
val, err := NewBox()
if err != nil {
panic(err.Error())
}
return val
}
// Deprecated:
func Print(ctx context.Context, nodes []string, out io.Writer) bool {
return PrintX(ctx, nodes, out) == nil
}
// Deprecated:
func (b *Box) Print(ctx context.Context,
nodes []string,
offset int,
out io.Writer) (bool, int, int) {
columns, nlines, err := b.PrintX(ctx, nodes, offset, out)
return err == nil, columns, nlines
}
// Deprecated:
func (b *Box) PrintNoLastLineFeed(ctx context.Context,
nodes []string,
offset int,
out io.Writer) (bool, int, int) {
if ctx == nil {
ctx = context.TODO()
}
col, row, err := b.PrintNoLastLineFeedX(ctx, nodes, offset, out)
return err == nil, col, row
}
// Deprecated:
func PrintNoLastLineFeed(ctx context.Context,
nodes []string,
offset int,
out io.Writer) (bool, int, int) {
b := New()
status, col, row := b.PrintNoLastLineFeed(ctx, nodes, offset, out)
b.Close()
return status, col, row
}
// Deprecated: Choice returns returns the string that user selected.
func Choice(sources []string, out io.Writer) string {
val, err := SelectString(sources, false, out)
if err != nil {
panic(err.Error())
}
if len(val) <= 0 {
return ""
}
return val[0]
}
// Deprecated: ChoiceMulti returns the strings that user selected.
func ChoiceMulti(sources []string, out io.Writer) []string {
val, err := SelectString(sources, true, out)
if err != nil {
panic(err.Error())
}
return val
}
// Deprecated: Choose Multi returns the indices that user selected.
func ChooseMulti(sources []string, out io.Writer) []int {
val, err := SelectIndex(sources, true, out)
if err != nil {
panic(err.Error())
}
return val
}
// Deprecated: Choose returns the index that user selected
func Choose(sources []string, out io.Writer) int {
val, err := SelectIndex(sources, false, out)
if err != nil {
panic(err.Error())
}
if len(val) <= 0 {
return -1
}
return val[0]
}