ui

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2019 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SkipThisAction = fmt.Errorf("skip this action")

SkipThisAction can be called inside `RunWithCheckboxes` mark the given action as skipped.

Functions

func FormatFailure

func FormatFailure(headline string, extraLines []string, err error) string

FormatFailure prints a formatted failure message. It should be used for errors where the program is going to terminate.

func FormatInfo

func FormatInfo(headline string, extraLines []string) string

FormatInfo prints a formatted info message. It should be used for useful information that you want to draw to the readers attention

func FormatSuccess

func FormatSuccess(headline string, extraLines []string) string

FormatSuccess prints a formatted info message. It should be used for a positive confirmation that something worked, with more information

func FormatWarning

func FormatWarning(headline string, extraLines []string, err error) string

FormatWarning prints a formatted failure message. It should be used for errors where the program is going to continue.

func PrintCheckboxFailure

func PrintCheckboxFailure(actionText string, err error)

func PrintCheckboxPending

func PrintCheckboxPending(actionText string)

func PrintCheckboxSkipped

func PrintCheckboxSkipped(actionText string)

func PrintCheckboxSuccess

func PrintCheckboxSuccess(actionText string)

func RunWithCheckboxes

func RunWithCheckboxes(checkboxMessage string, f func() error) error

RunWithCheckboxes executes the given function f and captures its return value, which must be error. Before running, it prints the "pending" checkbox, then if the function succeeds (error=nil), prints a success checkbox, otherwise prints a failed checkbox. example:

``` var apiResult response

if err := ui.RunWithCheckboxes("Uploading to API", func() error {
    apiResult, err = api.Upload(...)
    return err
})

```

Types

This section is empty.

Jump to

Keyboard shortcuts

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