in

package
v0.0.0-...-b3686c0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrParseUserFromStdin is returned when the user alias from stdin cannot be parsed
	ErrParseUserFromStdin = errors.New("invalid user id or account name from stdin")
	// ErrParseTweetFromStdin is returned when the tweet id from stdin cannot be parsed
	ErrParseTweetFromStdin = errors.New("invalid tweet id from stdin")
	// ErrParseInput is returned if the input from stdin cannot be parsed
	ErrParseInput = errors.New("failed parse input from stdin")
	// ErrAbortInput is returned if the user aborted input action
	ErrAbortInput = errors.New("waiting for input was aborted")
	// ErrUnknownInput is returned if the user entered an unknown action
	ErrUnknownInput = errors.New("unknown answer entered")
)

Functions

func AskForBool

func AskForBool(text string, def bool, skip bool) (bool, error)

AskForBool requires user bool input

func AskForConfirmation

func AskForConfirmation(text string, skip bool) bool

AskForConfirmation asks a yes/no question until the user replies yes or no

func AskForString

func AskForString(text, def string, skip bool) (string, error)

AskForString requires user text input

func IsValidStatus

func IsValidStatus(s string) bool

IsValidStatus returns wether the status is valid

func IsValidTweetID

func IsValidTweetID(s string) bool

IsValidTweetID checks wether the tweet id is valid or not

func IsValidUserID

func IsValidUserID(s string) bool

IsValidUserID checks wether the user id is valid or not

func IsValidUsername

func IsValidUsername(s string) bool

IsValidUsername returns wether the provided user name is valid or not

func ParseTweetFromArgs

func ParseTweetFromArgs(arg string, isFile bool) (int64, error)

ParseTweetFromArgs parses tweet id from stdin

func ParseTweetStatusFromArgs

func ParseTweetStatusFromArgs(arg string, isFile bool) (status string, err error)

ParseTweetStatusFromArgs parses tweet text from args

func ParseUserFromArgs

func ParseUserFromArgs(arg string, isFile bool) (userID int64, name string, err error)

ParseUserFromArgs parses userid or/and name from args

Types

type LineReader

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

LineReader is an unbuffered line reader

func NewReader

func NewReader(r io.Reader) *LineReader

NewReader creates a new line reader

func (LineReader) Read

func (lr LineReader) Read(p []byte) (int, error)

Read implements io.Reader

func (LineReader) ReadLine

func (lr LineReader) ReadLine() (string, error)

ReadLine reads one line without buffering

Jump to

Keyboard shortcuts

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