Documentation ¶
Index ¶
- type Option
- type Session
- func (s Session) Ask(questions ...cliquiz.Question) error
- func (s Session) AskConfirm(message string) error
- func (s *Session) End()
- func (s Session) EventBus() events.Bus
- func (s Session) NewOutput(label, color string) uilog.Output
- func (s Session) PauseSpinner() (restart func())
- func (s Session) Print(messages ...interface{}) error
- func (s Session) PrintTable(header []string, entries ...[]string) error
- func (s Session) Printf(format string, a ...interface{}) error
- func (s Session) Println(messages ...interface{}) error
- func (s *Session) StartSpinner(text string)
- func (s Session) StopSpinner()
- func (s Session) Verbosity() uilog.Verbosity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(s *Session)
Option configures session options.
func IgnoreEvents ¶ added in v0.26.0
func IgnoreEvents() Option
IgnoreEvents configures the session to avoid displaying events. This is a compatibility option to be able to use the session and the events bus when models are used to manage CLI UI. The session won't handle the events when this option is present.
func StartSpinner ¶ added in v0.25.0
func StartSpinner() Option
StartSpinner forces spinner to be spinning right after creation.
func StartSpinnerWithText ¶ added in v0.26.0
StartSpinnerWithText forces spinner to be spinning right after creation with a custom status text.
func WithStderr ¶ added in v0.25.0
func WithStderr(stderr io.WriteCloser) Option
WithStderr sets base stderr for a Session.
func WithStdin ¶ added in v0.25.0
func WithStdin(stdin io.ReadCloser) Option
WithStdin sets the starndard input for the session.
func WithStdout ¶ added in v0.25.0
func WithStdout(stdout io.WriteCloser) Option
WithStdout sets the starndard output for the session.
func WithVerbosity ¶ added in v0.25.0
WithVerbosity sets a verbosity level for the Session.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session controls command line interaction with users.
func (Session) AskConfirm ¶
AskConfirm asks yes/no question in the terminal.
func (*Session) End ¶ added in v0.25.0
func (s *Session) End()
End finishes the session by stopping the spinner and the event bus. Once the session is ended it should not be used anymore.
func (Session) NewOutput ¶ added in v0.25.0
NewOutput returns a new logging output bound to the session. The new output will use the session's verbosity, stderr and stdout. Label and color arguments are used to prefix the output when the session verbosity is verbose.
func (Session) PauseSpinner ¶
func (s Session) PauseSpinner() (restart func())
PauseSpinner pauses spinner and returns a function to restart the spinner.
func (Session) PrintTable ¶
PrintTable prints table data.
func (*Session) StartSpinner ¶
StartSpinner starts the spinner.
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. |
Package lineprefixer is a helpers to add prefixes to new lines.
|
Package lineprefixer is a helpers to add prefixes to new lines. |
Package prefixgen is a prefix generation helper for log messages and any other kind.
|
Package prefixgen is a prefix generation helper for log messages and any other kind. |
view
|
|