forked from cloudfoundry/bosh-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
non_tty_ui.go
65 lines (49 loc) · 1.51 KB
/
non_tty_ui.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
package ui
import (
. "github.com/cloudfoundry/bosh-cli/ui/table"
)
type NonTTYUI struct {
parent UI
}
func NewNonTTYUI(parent UI) *NonTTYUI {
return &NonTTYUI{parent: parent}
}
func (ui *NonTTYUI) ErrorLinef(pattern string, args ...interface{}) {
ui.parent.ErrorLinef(pattern, args...)
}
func (ui *NonTTYUI) PrintLinef(pattern string, args ...interface{}) {}
func (ui *NonTTYUI) BeginLinef(pattern string, args ...interface{}) {}
func (ui *NonTTYUI) EndLinef(pattern string, args ...interface{}) {}
func (ui *NonTTYUI) PrintBlock(block string) { ui.parent.PrintBlock(block) }
func (ui *NonTTYUI) PrintErrorBlock(block string) { ui.parent.PrintErrorBlock(block) }
func (ui *NonTTYUI) PrintTable(table Table) {
// hide decorations
table.Title = ""
table.Header = nil
table.HeaderVals = nil
table.Notes = nil
table.Content = ""
// necessary for grep
table.FillFirstColumn = true
// cut's default delim
table.BorderStr = "\t"
ui.parent.PrintTable(table)
}
func (ui *NonTTYUI) AskForText(label string) (string, error) {
return ui.parent.AskForText(label)
}
func (ui *NonTTYUI) AskForChoice(label string, options []string) (int, error) {
return ui.parent.AskForChoice(label, options)
}
func (ui *NonTTYUI) AskForPassword(label string) (string, error) {
return ui.parent.AskForPassword(label)
}
func (ui *NonTTYUI) AskForConfirmation() error {
return ui.parent.AskForConfirmation()
}
func (ui *NonTTYUI) IsInteractive() bool {
return ui.parent.IsInteractive()
}
func (ui *NonTTYUI) Flush() {
ui.parent.Flush()
}