forked from fzdwx/infinite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
infinite.go
46 lines (38 loc) · 1.36 KB
/
infinite.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
package infinite
import (
"github.com/fzdwx/infinite/components/input/confirm"
"github.com/fzdwx/infinite/components/input/text"
"github.com/fzdwx/infinite/components/progress"
cs "github.com/fzdwx/infinite/components/selection/confirm"
"github.com/fzdwx/infinite/components/selection/multiselect"
"github.com/fzdwx/infinite/components/selection/singleselect"
"github.com/fzdwx/infinite/components/spinner"
)
// NewMultiSelect new multi select
func NewMultiSelect(choices []string, ops ...multiselect.Option) *multiselect.Select {
return multiselect.New(choices, ops...)
}
// NewSingleSelect new single select
func NewSingleSelect(choices []string, ops ...singleselect.Option) *singleselect.Select {
return singleselect.New(choices, ops...)
}
// NewSpinner new spinner
func NewSpinner(ops ...spinner.Option) *spinner.Spinner {
return spinner.New(ops...)
}
// NewText new text input
func NewText(ops ...text.Option) *text.Text {
return text.New(ops...)
}
// NewConfirm new confirm
func NewConfirm(ops ...confirm.Option) *confirm.Confirm {
return confirm.New(ops...)
}
// NewConfirmWithSelection new confirm with Selection
func NewConfirmWithSelection(ops ...cs.Option) *cs.Confirm {
return cs.WithSelection(ops...)
}
// NewProgressGroup new progress group with count.
func NewProgressGroup(processCnt int) *progress.Group {
return progress.NewGroupWithCount(processCnt)
}