cliui

package
v0.0.0-...-7149754 Latest Latest
Warning

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

Go to latest
Published: May 28, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(s *Session)

func WithInput

func WithInput(input io.Reader) Option

WithInput sets input stream for a session.

func WithOutput

func WithOutput(output io.Writer) Option

WithOutput sets output stream for a session.

type Session

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

Session controls command line interaction with users.

func New

func New(options ...Option) Session

New creates new Session.

func (Session) Ask

func (s Session) Ask(questions ...cliquiz.Question) error

Ask asks questions in the terminal and collect answers.

func (Session) AskConfirm

func (s Session) AskConfirm(message string) error

AskConfirm asks yes/no question in the terminal.

func (Session) Cleanup

func (s Session) Cleanup()

Cleanup ensure spinner is stopped and printLoop exited correctly.

func (Session) EventBus

func (s Session) EventBus() events.Bus

StopSpinner returns session's event bus.

func (Session) PauseSpinner

func (s Session) PauseSpinner() (mightResume func())

PauseSpinner pauses spinner, returns resume function to start paused spinner again.

func (Session) Print

func (s Session) Print(messages ...interface{}) error

Println prints arbitrary message

func (Session) PrintSaidNo

func (s Session) PrintSaidNo() error

PrintSaidNo prints message informing negative was given in a confirmation prompt

func (Session) PrintTable

func (s Session) PrintTable(header []string, entries ...[]string) error

PrintTable prints table data.

func (Session) Printf

func (s Session) Printf(format string, a ...interface{}) error

Printf prints formatted arbitrary message.

func (Session) Println

func (s Session) Println(messages ...interface{}) error

Println prints arbitrary message with line break.

func (Session) StartSpinner

func (s Session) StartSpinner(text string)

StartSpinner starts spinner.

func (Session) StopSpinner

func (s Session) StopSpinner()

StopSpinner stops spinner.

func (Session) Wait

func (s Session) Wait()

Wait blocks until all queued events are handled.

Directories

Path Synopsis
Package cliquiz is a tool to collect answers from the users on cli.
Package cliquiz is a tool to collect answers from the users on cli.

Jump to

Keyboard shortcuts

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