Categorygithub.com/atsuya0/go-chooser
repositorypackage
1.0.5
Repository: https://github.com/atsuya0/go-chooser.git
Documentation: pkg.go.dev

# README

go-chooser

gif

Key bindings

keydescription
EnterReturns the character string under the cursor. Or returns the selected character string.
TabSelect the character string under the cursor.
BackspaceDelete a character before cursor.
DeleteDelete a character under cursor.
C-dDelete a character under cursor.
C-hDelete a character before cursor.
C-fMove forward a character.
C-bMove backward a character.
C-aGo to the beginning of the line.
C-eGo to the end of the line.
C-uKill characters from cursor current position to the beginning of the line.
C-kKill characters from cursor current position to the end of the line.
C-wDelete before a word.
C-nMove the cursor to the next line.
C-pMove the cursor to the previous line.
?Display the key bindings.

Examples

package main

import (
	"fmt"
	"log"

	"github.com/atsuya0/go-chooser"
)

func main() {
	chooser, err := chooser.NewChooser(
		[]string{
			"about five hundred yen",
			"get to the airport",
			"be angry with sb",
			"play baseball",
			"bring money",
			"listen to Beatle’s CD",
			"fifty cents",
			"be dead",
			"be not far",
			"use a fork",
			"pull a door",
			"listen to music",
			"put salt"})
	if err != nil {
		log.Fatalf("%v\n", err)
	}

	/*
		index, string, err := chooser.SingleRun()
		if err != nil {
			log.Fatalf("%v\n", err)
		}
		fmt.Printf("%#v\n", index)
		fmt.Printf("%#v\n", string)
	*/

	indexes, strings, err := chooser.Run()
	if err != nil {
		log.Fatalf("%v\n", err)
	}
	fmt.Printf("%#v\n", indexes)
	fmt.Printf("%#v\n", strings)
}