app_ui

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MConsole = app_msg.Apply(&MsgConsole{}).(*MsgConsole)
)
View Source
var (
	MProgress = app_msg.Apply(&MsgProgress{}).(*MsgProgress)
)

Functions

func Join

func Join(ui UI, messages ...app_msg.Message) app_msg.Message

func MakeConsoleDemo

func MakeConsoleDemo(mc app_msg_container.Container, f func(ui UI)) string

func MakeMarkdown

func MakeMarkdown(mc app_msg_container.Container, f func(ui UI)) string

func ShowLongRunningProgress

func ShowLongRunningProgress(ui UI, seed string, msg app_msg.Message)

func ShowProgress

func ShowProgress(ui UI)

func ShowProgressWithMessage

func ShowProgressWithMessage(ui UI, msg app_msg.Message)

Types

type MsgConsole

type MsgConsole struct {
	LargeReport       app_msg.Message
	OpenArtifactError app_msg.Message
	OpenArtifact      app_msg.Message
	PointArtifact     app_msg.Message
	Progress          app_msg.Message
}

type MsgProgress

type MsgProgress struct {
	Progress app_msg.Message
}

type RowLimiter

type RowLimiter interface {
	Row(f func())
	Flush()
}

func NewRowLimiter

func NewRowLimiter(sy Syntax, name string) RowLimiter

type Syntax

type Syntax interface {
	// Header
	Header(m app_msg.Message)

	// Sub header
	SubHeader(m app_msg.Message)

	// Info
	Info(m app_msg.Message)

	// Create information table
	InfoTable(name string) Table

	// Error
	Error(m app_msg.Message)

	// Break
	Break()

	// Ask to continue. This confirmation step may be skipped on some UI implementation.
	// If you want to ensure actual user acknowledge, please use AskCont instead.
	AskProceed(m app_msg.Message)

	// Ask continue
	AskCont(m app_msg.Message) (cont bool)

	// Ask for a text
	AskText(m app_msg.Message) (text string, cancel bool)

	// Ask for a credentials
	AskSecure(m app_msg.Message) (secure string, cancel bool)

	// Display success message
	Success(m app_msg.Message)

	// Display failure message
	Failure(m app_msg.Message)

	// Display progress
	Progress(m app_msg.Message)

	// Code block
	Code(code string)

	// Quote
	Quote(m app_msg.Message)

	// Link to artifact
	Link(artifact rp_artifact.Artifact)

	// True when the syntax is for console
	IsConsole() bool

	// True when the syntax is for web
	IsWeb() bool

	// New UI with given message syntax
	WithContainerSyntax(mc app_msg_container.Container) Syntax

	// Message container of this UI
	Messages() app_msg_container.Container
}

type Table

type Table interface {
	Header(h ...app_msg.Message)
	HeaderRaw(h ...string)
	Row(m ...app_msg.Message)
	RowRaw(m ...string)
	Flush()
}

type UI

type UI interface {
	Syntax

	// Test existence of the message key
	Exists(m app_msg.Message) bool

	// Dealing with table. Table will be automatically closed after the f finished.
	WithTable(name string, f func(t Table))

	// Compile text
	Text(m app_msg.Message) string

	// Compile text, returns empty string if the key is not found
	TextOrEmpty(m app_msg.Message) string

	// Unique identifier of this UI
	Id() string

	// New UI with given message container
	WithContainer(mc app_msg_container.Container) UI
}

func NewDiscard

func NewDiscard(mc app_msg_container.Container, lg esl.Logger) UI

func NewProxy

func NewProxy(sy Syntax, lg esl.Logger) UI

Jump to

Keyboard shortcuts

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