common

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ExitCodeCanceled is the exit code if the user cancled or closed the dialog.
	ExitCodeCanceled = 1
)
View Source
const (
	LineBreak = "\n"
)

Variables

This section is empty.

Functions

func AddFlagsEntry

func AddFlagsEntry(cmd *cobra.Command, s *set.Entry)

func AddFlagsFileSave

func AddFlagsFileSave(cmd *cobra.Command, s *set.FileSave)

func AddFlagsFileSelection

func AddFlagsFileSelection(cmd *cobra.Command, s *set.FileSelection)

func AddFlagsMessage

func AddFlagsMessage(cmd *cobra.Command, s *set.Message)

func AddFlagsNotification

func AddFlagsNotification(cmd *cobra.Command, s *set.Notification)

func AddFlagsOptions

func AddFlagsOptions(cmd *cobra.Command, s *set.Options)

func DefaultExtraButtonCallback

func DefaultExtraButtonCallback(g *res.General) func() error

DefaultExtraButtonCallback is the default extra button callback.

func HandleGeneralJSONResult

func HandleGeneralJSONResult(ctx *CmdContext, err error) error

HandleGeneralJSONResult handles the output of the general result.

func HandleGeneralResult

func HandleGeneralResult(ctx *CmdContext,
	g *res.General,
	err error,
	okCallback func() error,
	cancelCallback func() error,
	extraCallback func() error) error

HandleGeneralResult handles output of general result on stdout.

func HandleJSONResult

func HandleJSONResult(ctx *CmdContext, r res.JSONResult, g *res.General, err error) error

HandleJSONResult handles the output of the result in form of JSON.

func OutputArray

func OutputArray(l []string, sep string) (err error)

OutputArray outputs a string array to std output with an appended line break.

func OutputIndexArray

func OutputIndexArray(l []uint, sep string) error

OutputArray outputs an index array to std output.

func OutputString

func OutputString(s string) (err error)

Outputs a single string.

Types

type CmdContext

type CmdContext struct {

	// Exit code of the dialog app.
	ExitCode ExitCode

	// Report as JSON
	ReportAsJSON bool

	// Log context.
	Log cm.ILogContext
}

type ExitCode

type ExitCode = uint

Jump to

Keyboard shortcuts

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