Help you to create interactive command line applications in Go.
Full Changelog: https://github.com/fzdwx/infinite/compare/v0.12.0...v0.12.1
fix: confirm(selection) view error #44
Full Changelog: https://github.com/fzdwx/infinite/compare/v0.11.2...v0.12.0
break changes :
PageSize
field, add SetPageSize
func on https://github.com/fzdwx/infinite/commit/132864d48a9c17edb0eabe2506ba3e9ab321ea2f
func main() {
options := []string{
"1 Buy carrots",
"2 Buy celery",
"3 Buy kohlrabi",
"4 Buy computer",
"5 Buy something",
"6 Buy car",
"7 Buy subway",
}
selectKeymap := singleselect.DefaultSingleKeyMap()
selectKeymap.Confirm = key.NewBinding(
key.WithKeys("enter"),
key.WithHelp("enter", "finish select"),
)
selectKeymap.Choice = key.NewBinding(
key.WithKeys("enter"),
key.WithHelp("enter", "finish select"),
)
selectKeymap.NextPage = key.NewBinding(
key.WithKeys("right"),
key.WithHelp("->", "next page"),
)
selectKeymap.PrevPage = key.NewBinding(
key.WithKeys("left"),
key.WithHelp("<-", "prev page"),
)
selected, err := inf.NewSingleSelect(
options,
singleselect.WithDisableFilter(),
singleselect.WithKeyBinding(selectKeymap),
singleselect.WithPageSize(5),
).Display("Hello world")
if err == nil {
fmt.Printf("you selection %s\n", options[selected])
}
}
break changes: split style on https://github.com/fzdwx/infinite/commit/69b0123427eeaccbac6d9f05cd61010951c0a3d3
break changes: remove BackgroundStyle
field on https://github.com/fzdwx/infinite/commit/ef561979274d8d07f03a03aef08a25fb9b75bd8a
update deps
select
help key filter https://github.com/fzdwx/infinite/commit/3d77305d84718a8c023a6bf928fb1c7bec01c628
only show choice
selectKeymap := singleselect.DefaultSingleKeyMap()
selectKeymap.Confirm = key.NewBinding(
key.WithKeys("enter"),
key.WithHelp("enter", "finish select"),
)
selectKeymap.Choice = key.NewBinding(
key.WithKeys("enter"),
key.WithHelp("enter", "finish select"),
)
selected, err := inf.NewSingleSelect(
options,
singleselect.WithDisableFilter(),
singleselect.WithKeyBinding(selectKeymap),
).Display("Hello world")
Full Changelog: https://github.com/fzdwx/infinite/compare/v0.8.7.2...v0.8.8
changelog:
OutputResult
and DisplayHelp
are not handled correctlyautocomplete
adapt to the new features of input
Allows you to exit the program at any time while the program is running,the key of the main response in the component is quit
, you can replace with the key you want, default is:
InterruptKey = key.NewBinding(
key.WithKeys("ctrl+c"),
key.WithHelp("^C", "kill program"),
)
default handle is :
OnUserInterrupt = func(p *tea.Program) {
p.Kill()
os.Exit(0)
}
You can modify it like this:
components.OnUserInterrupt = func(p *tea.Program) {
...
}
thanks @whatwewant .