promptable

package
v0.0.0-...-cc79a08 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPromptable

func IsPromptable(c Contextualizer) bool

IsPromptable reports whether the output type permits prompts to be shown.

func IsPromptableOnce

func IsPromptableOnce(c Contextualizer, cfg Configurer, key OnceKey) bool

IsPromptableOnce reports whether the given context permits prompts to be shown and also whether a prompt has not been shown before.

func SetPrompted

func SetPrompted(cfg Configurer, key OnceKey) bool

SetPrompted tracks whether a prompt has been called before using the config type and key. A response of true indicates that the config has been updated. A response of false indicates that the config has not been updated. If the configuration "set" call fails, this functions always returns true.

Types

type Configurer

type Configurer interface {
	GetBool(key string) (value bool)
	Set(key string, value interface{}) error
}

Configurer describes the behavior required to track info via config.

type Contextualizer

type Contextualizer interface {
	IsInteractive() bool
}

Contextualizer describes any type which can provide needed contextual info.

type OnceKey

type OnceKey string

OnceKey represents config keys as tokens.

const (
	DefaultProject OnceKey = "default_project_prompt"
)

OnceKey contants enumerate relevant config keys.

Jump to

Keyboard shortcuts

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