Documentation
¶
Index ¶
- Constants
- Variables
- func AddErrToStack(ctx context.Context, cmd *cobra.Command, err error) tea.Cmd
- func AddToStack[T any](stack *tui.StackModel, cmd *cobra.Command, breadcrumb string, in T, ...) tea.Cmd
- func AddToStackFunc[T any](ctx context.Context, cmd *cobra.Command, breadcrumb string, in T, m tea.Model) tea.Cmd
- func CommandName(cmd *cobra.Command, v any) (string, error)
- func DefaultFormatNonInteractive(cmd *cobra.Command)
- func Fatal(cmd *cobra.Command, err error)
- func GetConfirmFromContext(ctx context.Context) bool
- func InputToString(v any) (string, error)
- func LoadCmd[T any, D any](ctx context.Context, loadData func(context.Context, T) (D, error), in T) tui.TypedCmd[D]
- func NewStringFormValue(s string) *stringFormValue
- func NewStringSliceFormValue(s string) *stringSliceFormValue
- func NonInteractive[T any](cmd *cobra.Command, loadData LoadDataFunc[T], formatText FormatTextFunc[T]) (bool, error)
- func NonInteractiveWithConfirm[T any](cmd *cobra.Command, loadData LoadDataFunc[T], formatText FormatTextFunc[T], ...) (bool, error)
- func PaginatedLoadCmd[T any, D any](ctx context.Context, ...) tui.TypedCmd[D]
- func ParseCommand(cmd *cobra.Command, args []string, v any) error
- func ParseCommandInteractiveOnly(cmd *cobra.Command, args []string, v any) error
- func PrintData[T any](cmd *cobra.Command, data T, formatText FormatTextFunc[T]) (bool, error)
- func Println(cmd *cobra.Command, format string, a ...any)
- func RunProgram(name string, args ...string) error
- func SetConfirmInContext(ctx context.Context, confirm bool) context.Context
- func SetFormatInContext(ctx context.Context, output *Output) context.Context
- func StructFromFormValues(formValues FormValues, v any) error
- func TimeSuggestion(str string) []string
- func WrapInConfirm[D any](cmd tui.TypedCmd[D], msgFunc func() (string, error)) tui.TypedCmd[D]
- type CTXConfirmKey
- type CTXConfirmValue
- type CTXOutputKey
- type CTXOutputValue
- type CobraEnum
- type CobraTime
- type ConfirmFunc
- type FormValue
- type FormValues
- type FormatTextFunc
- type InteractiveFunc
- type LoadDataFunc
- type Output
- type RequireConfirm
- type TextTable
- type TimeOrRelative
- type WrapOptions
- type WrappedFunc
Constants ¶
View Source
const ConfirmFlag = "confirm"
View Source
const (
EnumType = "enum"
)
View Source
const (
TimeType = "time"
)
Variables ¶
View Source
var ErrActionNotAllowed = errors.New("you are not allowed to take this action")
View Source
var ErrTokenExpired = errors.New("your token is expired; run `render login` to get a new one")
View Source
var RFC3339RegexString = []string{
`\d`, `\d`, `\d`, `\d`, `-`, `\d`, `\d`, `-`, `\d`, `\d`,
`T`, `\d`, `\d`, `:`, `\d`, `\d`, `:`, `\d`, `\d`,
}
Functions ¶
func AddToStack ¶
func AddToStackFunc ¶
func GetConfirmFromContext ¶
func InputToString ¶
func NewStringFormValue ¶
func NewStringFormValue(s string) *stringFormValue
func NewStringSliceFormValue ¶
func NewStringSliceFormValue(s string) *stringSliceFormValue
func NonInteractive ¶
func NonInteractive[T any](cmd *cobra.Command, loadData LoadDataFunc[T], formatText FormatTextFunc[T]) (bool, error)
func NonInteractiveWithConfirm ¶
func NonInteractiveWithConfirm[T any](cmd *cobra.Command, loadData LoadDataFunc[T], formatText FormatTextFunc[T], confirmMessageFunc ConfirmFunc) (bool, error)
func PaginatedLoadCmd ¶
func RunProgram ¶
func SetConfirmInContext ¶
func SetFormatInContext ¶
func StructFromFormValues ¶
func StructFromFormValues(formValues FormValues, v any) error
func TimeSuggestion ¶
Types ¶
type CTXConfirmKey ¶
type CTXConfirmKey struct{}
type CTXConfirmValue ¶
type CTXConfirmValue struct {
Confirm bool
}
type CTXOutputKey ¶
type CTXOutputKey struct{}
type CTXOutputValue ¶
type CTXOutputValue struct {
Output *Output
}
type CobraEnum ¶
type CobraEnum struct {
// contains filtered or unexported fields
}
func NewEnumInput ¶
func (*CobraEnum) IsMultiSelect ¶
func (*CobraEnum) SelectedValues ¶
type CobraTime ¶
type CobraTime struct {
// contains filtered or unexported fields
}
func NewTimeInput ¶
func NewTimeInput() *CobraTime
func (*CobraTime) Get ¶
func (e *CobraTime) Get() *TimeOrRelative
type ConfirmFunc ¶
type FormValues ¶
func FormValuesFromStruct ¶
func FormValuesFromStruct(v any) FormValues
func HuhFormFields ¶
type FormatTextFunc ¶
type InteractiveFunc ¶
type LoadDataFunc ¶
type Output ¶
type Output string
func GetFormatFromContext ¶
func StringToOutput ¶
func (*Output) Interactive ¶
type RequireConfirm ¶
type TimeOrRelative ¶
func (*TimeOrRelative) String ¶
func (t *TimeOrRelative) String() string
type WrapOptions ¶
type WrapOptions[T any] struct { RequireConfirm RequireConfirm[T] }
Click to show internal directories.
Click to hide internal directories.