term

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Output

func Output(ctx context.Context, options Options, pages *model.Reply, format []string) error

Output the feed of replies, printing the given columns (if any)

func Readline

func Readline(prompt string, password bool) (string, error)

Readline reads a single line of input

Types

type Input

type Input interface {
	Next() bool           // Next returns true if there is a reply to Get
	Get() json.RawMessage // Get the current reply
	Error() error         // Error returns the non-nil error if the iteration broke
}

Input object, "sort of" iterable object that allows iteration. you can iterate over this with a loop like:

for r.Next() {
  current := r.Get()
}
if r.Error() != nil {
  iteration ended with error
}

func Once

func Once(msg json.RawMessage) Input

Once creates an Input that returns a single value

func Stdin

func Stdin() (Input, error)

Stdin returns a Input stream if stdin is not a tty, nil otherwise

type Options

type Options struct {
	PageSize    int
	Paginate    bool
	SkipHeaders bool
	PrettyPrint bool
}

Options stores pagination options

Jump to

Keyboard shortcuts

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