stdin

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package stdin provides easy stdin util.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyInput = errors.New("stdin: empty input")
	ErrTooManyTry = errors.New("stdin: too many try")
)

Errors.

Reader is the stdin reader.

Functions

This section is empty.

Types

type Input

type Input struct {
	// contains filtered or unexported fields
}

Input represents a input entity.

func New

func New(prompt string) *Input

New creates a new input entity.

func (*Input) Bool

func (a *Input) Bool() (bool, error)

Bool reads a bool value.

func (*Input) Default

func (a *Input) Default(o string) *Input

Default sets the default value.

func (*Input) Duration

func (a *Input) Duration() (time.Duration, error)

Duration reads a duration value.

func (*Input) Float

func (a *Input) Float() (float64, error)

Float reads a float value.

func (*Input) Format

func (a *Input) Format(o string) *Input

Format sets the format.

func (*Input) Int

func (a *Input) Int() (int, error)

Int reads a int value.

func (*Input) MustBool

func (a *Input) MustBool() bool

MustBool reads a bool value.

func (*Input) MustDuration

func (a *Input) MustDuration() time.Duration

MustDuration reads a duration value.

func (*Input) MustFloat

func (a *Input) MustFloat() float64

MustFloat reads a float value.

func (*Input) MustInt

func (a *Input) MustInt() int

MustInt reads a int value.

func (*Input) MustString

func (a *Input) MustString() string

MustString reads a string value.

func (*Input) MustTime

func (a *Input) MustTime() time.Time

MustTime reads a time value.

func (*Input) Prefix

func (a *Input) Prefix(o string) *Input

Prefix sets the prefix.

func (*Input) Prompt

func (a *Input) Prompt(o string) *Input

Prompt sets the prompt.

func (*Input) String

func (a *Input) String() (string, error)

String reads a string value.

func (*Input) Time

func (a *Input) Time() (time.Time, error)

Time reads a time value.

func (*Input) Try

func (a *Input) Try(o int) *Input

Try sets the try times.

Jump to

Keyboard shortcuts

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