listcmd

package
v0.0.0-...-b00e3da Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type List

type List struct {
	Flags *dbflags.Flags

	// KeyRe (-key-regexp) when non-empty must be a regexp to filter-out keys
	// from the listing.
	KeyRe string

	// ValueType (-value-type) when non-empty indicates the data type of the
	// value at the selected key. This flag is enabled only when List command is
	// created with a parser function.
	ValueType string

	// PrintTemplate (-print-template) when non-empty must be a text/template
	// definition used to format/process the value for keys selected for
	// listing. This flag is enabled only when List command is created with a
	// parser function.
	PrintTemplate string

	// Descend (-descend) when true changes the sorting order to descending.
	Descend bool
	// contains filtered or unexported fields
}

func New

func New(flags *dbflags.Flags, parsef ParseFunc) *List

New creates a list command instance with given flags as the defaults.

func (*List) Command

func (c *List) Command() (string, *flag.FlagSet, cli.CmdFunc)

func (*List) Purpose

func (c *List) Purpose() string

type ParseFunc

type ParseFunc = func(key string, value []byte, valueTypeFlag string) (any, error)

ParseFunc converts the raw value for the given key into a Go value to process with the print template. If the key alone cannot identify the value type, additional argument valueTypeFlag passed by the user from the command line may be used as necessary.

Jump to

Keyboard shortcuts

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