chooser

package module
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2021 License: MIT Imports: 12 Imported by: 3

README

go-chooser

gif

Key bindings

key description
Enter Returns the character string under the cursor. Or returns the selected character string.
Tab Select the character string under the cursor.
Backspace Delete a character before cursor.
Delete Delete a character under cursor.
C-d Delete a character under cursor.
C-h Delete a character before cursor.
C-f Move forward a character.
C-b Move backward a character.
C-a Go to the beginning of the line.
C-e Go to the end of the line.
C-u Kill characters from cursor current position to the beginning of the line.
C-k Kill characters from cursor current position to the end of the line.
C-w Delete before a word.
C-n Move the cursor to the next line.
C-p Move 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)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewChooser

func NewChooser(list []string) (*chooser, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL