Fzdwx Infinite Versions Save

Help you to create interactive command line applications in Go.

v0.12.1

10 months ago

Full Changelog: https://github.com/fzdwx/infinite/compare/v0.12.0...v0.12.1

fix: confirm(selection) view error #44

v0.12.0

11 months ago

Full Changelog: https://github.com/fzdwx/infinite/compare/v0.11.2...v0.12.0

Selection

break changes :

  1. remove PageSize field, add SetPageSize func on https://github.com/fzdwx/infinite/commit/132864d48a9c17edb0eabe2506ba3e9ab321ea2f
  2. Change the logic of page turning, previously it was scrolling, now it is forced paging on https://github.com/fzdwx/infinite/commit/ed0facbc9109fba795bb1d8b74f5c57624bfd4dc
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])
	}

}

Input confirm

break changes: split style on https://github.com/fzdwx/infinite/commit/69b0123427eeaccbac6d9f05cd61010951c0a3d3

Input

break changes: remove BackgroundStyle field on https://github.com/fzdwx/infinite/commit/ef561979274d8d07f03a03aef08a25fb9b75bd8a

Others

update deps

v0.11.2

1 year ago
  1. feat: add 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")

v0.11.1

1 year ago
  1. faet: unselected before quit #41 by @wangzhiy

v0.10.1

1 year ago

no new component

change

  1. add selection Validator(by @wangzhiy #39)
  2. upgrade dependence version and fire code

v0.8.5

1 year ago

changelog:

  1. feat #28 image image
  2. fix confirm(input) OutputResult and DisplayHelp are not handled correctly
  3. autocomplete adapt to the new features of input

v0.8.4

1 year ago
  1. add confirm(selection) help view
  2. fix #29

v0.8.2

1 year ago

Changelog

  1. add FocusSymbol UnFocusSymbol FocusInterval UnFocusInterval to selection , confirm(input)
  2. unify quit key so that it can be modified uniformly at runtime.
components.InterruptKey = key.NewBinding(
		xxx
)

v0.7.5

1 year ago

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 .