utils

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: GPL-3.0 Imports: 3 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseIndexSelection

func ParseIndexSelection[DataType any](selectionString string, options []SelectionOption[DataType]) ([]*DataType, error)

Parse a comma-separated list of indices to select in a multi-index operation

func ParseOptionIDs

func ParseOptionIDs[DataType any](selectionString string, options []SelectionOption[DataType]) ([]*DataType, error)

Parse a comma-separated list of option IDs to select in a multi-index operation

Types

type SelectionOption

type SelectionOption[DataType any] struct {
	// The underlying element this option represents
	Element *DataType

	// The human-readable ID of the option, used for non-interactive selection
	ID string

	// The text to display for this option when listing the available options
	Display string
}

An option that can be selected from a list of choices in the CLI

Jump to

Keyboard shortcuts

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