Skip to content

Commit c091ad6

Browse files
committed
Add confirm pure option(for test #33)
1 parent 1bfacbe commit c091ad6

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

_examples/confirm/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
func main() {
1010

1111
c := inf.NewConfirm(
12+
confirm.WithPure(),
1213
confirm.WithDefaultYes(),
1314
//confirm.WithDisableOutputResult(),
1415
//confirm.WithPrompt("hello world?"),

components/input/confirm/options.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ import (
66

77
type Option func(confirm *Confirm)
88

9+
// WithPure do not use any beautification features,
10+
// any options you customize will be cleared
11+
func WithPure() Option {
12+
return func(i *Confirm) {
13+
i.inner.FocusSymbolStyle = style.New()
14+
i.inner.UnFocusSymbolStyle = style.New()
15+
i.inner.FocusIntervalStyle = style.New()
16+
i.inner.UnFocusIntervalStyle = style.New()
17+
i.inner.ValueStyle = style.New()
18+
}
19+
}
20+
921
// WithDefaultYes the `confirm` default is no,
1022
// adding this option will turn into yes.
1123
func WithDefaultYes() Option {

0 commit comments

Comments
 (0)