cparam

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: MIT Imports: 5 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	TypeStringParam  = "string"
	TypeChoicesParam = "choices"
)

params types

Variables

This section is empty.

Functions

This section is empty.

Types

type ChoiceParam

type ChoiceParam struct {
	InputParam
	// Choices for select
	Choices []string
	// contains filtered or unexported fields
}

ChoiceParam definition

func NewChoiceParam

func NewChoiceParam(name, desc string) *ChoiceParam

NewChoiceParam instance

func (*ChoiceParam) Run

func (p *ChoiceParam) Run() (err error)

Run param and get user input

func (*ChoiceParam) Selected

func (p *ChoiceParam) Selected() string

Selected values get

func (*ChoiceParam) Set

func (p *ChoiceParam) Set(v string) error

Set value

func (*ChoiceParam) WithChoices

func (p *ChoiceParam) WithChoices(Choices []string) *ChoiceParam

WithChoices to param definition

type ChoicesParam

type ChoicesParam struct {
	InputParam
	// Choices for select
	Choices []string
	// contains filtered or unexported fields
}

ChoicesParam definition

func NewChoicesParam

func NewChoicesParam(name, desc string) *ChoicesParam

NewChoicesParam instance

func (*ChoicesParam) Run

func (p *ChoicesParam) Run() (err error)

Run param and get user input

func (*ChoicesParam) Selected

func (p *ChoicesParam) Selected() []string

Selected values get

func (*ChoicesParam) Set

func (p *ChoicesParam) Set(v string) error

Set value

func (*ChoicesParam) WithChoices

func (p *ChoicesParam) WithChoices(Choices []string) *ChoicesParam

WithChoices to param definition

type InputParam

type InputParam struct {

	// Default value
	Default any
	ValidFn func(val string) error
	// contains filtered or unexported fields
}

InputParam struct

func NewInputParam

func NewInputParam(typ, name, desc string) *InputParam

NewInputParam instance

func (*InputParam) Desc

func (p *InputParam) Desc() string

Desc message

func (*InputParam) Name

func (p *InputParam) Name() string

Name get

func (*InputParam) Run

func (p *InputParam) Run() (err error)

Run param and get user input

func (*InputParam) Set

func (p *InputParam) Set(v string) error

Set value and with validate

func (*InputParam) SetFunc

func (p *InputParam) SetFunc(fn RunFn)

SetFunc for run

func (*InputParam) SetValidFn

func (p *InputParam) SetValidFn(fn func(val string) error)

SetValidFn for run

func (*InputParam) String

func (p *InputParam) String() string

Value get

func (*InputParam) Type

func (p *InputParam) Type() string

Type name get

func (*InputParam) Valid

func (p *InputParam) Valid(v string) error

Valid value validate

func (*InputParam) Value

func (p *InputParam) Value() structs.Value

Value data get

type RunFn

type RunFn func() (val string, err error)

RunFn func type

type StringParam

type StringParam struct {
	InputParam
}

StringParam definition

func NewStringParam

func NewStringParam(name, desc string) *StringParam

NewStringParam instance

func (*StringParam) Config

func (p *StringParam) Config(fn func(p *StringParam)) *StringParam

Config param

func (*StringParam) Run

func (p *StringParam) Run() (err error)

Run param and get user input

Jump to

Keyboard shortcuts

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