utils

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTime

func GetTime(f *pflag.FlagSet, name string) (time.Time, error)

func PromptForPassphrase

func PromptForPassphrase(confirm bool) (string, error)

func PromptReonboard

func PromptReonboard(r io.Reader, w io.Writer) error

PromptReonboard is a wrapper of utils.PromptYesNo with custom prompt that return error if user declines reonboard

func PromptYesNo

func PromptYesNo(in io.Reader, out io.Writer, prompt string) (bool, error)

PromptYesNo loops on confirmation from user until valid answer

Types

type TimeValue

type TimeValue struct {
	Time    *time.Time
	Formats []string
}

TimeValue adapts time.Time for use as a flag.

func NewTimeValue

func NewTimeValue(t *time.Time, formats ...string) *TimeValue

NewTimeValue creates a new TimeValue.

func (TimeValue) Set

func (t TimeValue) Set(s string) error

Set time.Time value from string based on accepted formats.

func (TimeValue) String

func (t TimeValue) String() string

String returns the string representation of the time.Time value.

func (TimeValue) Type

func (t TimeValue) Type() string

Type name for time.Time flags.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳