cui

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PrefixRegularMsg = "$[1;32][*]$[] "
	PrefixErrMsg     = "$[1;31][!]$[] "
)

The prefix added to the beginning of the message when it is to be written to the standard output or error.

Functions

func PrintArgErrMsg

func PrintArgErrMsg(argErrs []*appbase.ArgErr) error

PrintArgErrMsg prints all command line argument error messages line by line, using the error message prefix. The key of the message string in the global string table must be one of the followings:

"[MSG]ERR.UNRECOGNIZED_TL_CMD" // Shows that it is an unrecognized top-level command.
"[MSG]ERR.UNRECOGNIZED_NTL_CMD" // Shows that it is an unrecognized non-top-level command.
"[MSG]ERR.UNRECOGNIZED_OPT" // Shows that it is an unrecognized option.
"[MSG]ERR.ARG_MISSING_IN_OPT" // Shows that an argument is missing in the option.

The following placeholder can be used in the string value:

"${#AE.SUP_CMD}" // The superior command name.
"${#AE.CMD}" // The command name.
"${#AE.OPT}" // The option name.

[PARAMETERS]

argErrs []*appbase.ArgErr // All the command line argument errors. Generally, it is returned by [ParseArgs].

[RETURNS]

error // If the function succeeds, it is nil, otherwise it is the first error encountered during printing.

func PrintErrMsg

func PrintErrMsg(id string, st appbase.StrTable) error

PrintErrMsg prints the error message which is set in the global string table to the standard error stream, using the error message prefix. The key of the message string in the global string table follows this format:

"[MSG]ERR.ID"

where ID is the value of the string parameter [id].

[PARAMETERS]

id string // The string identifier that describes the error type.
st appbase.StrTable // The string table for expanding any string reference. If it is nil, the global string table is used.

[RETURNS]

error // If the function succeeds, it is nil, otherwise it is the first error encountered during printing.

func PrintRegularMsg

func PrintRegularMsg(id string, st appbase.StrTable) error

PrintRegularMsg prints the regular message which is set in the global string table to the standard error stream, using the regular message prefix. The key of the message string in the global string table follows this format:

"[MSG]REG.ID"

where ID is the value of the string parameter [id].

[PARAMETERS]

id string // The string identifier of the message.
st appbase.StrTable // The string table for expanding any string reference. If it is nil, the global string table is used.

[RETURNS]

error // If the function succeeds, it is nil, otherwise it is the first error encountered during printing.

Types

This section is empty.

Jump to

Keyboard shortcuts

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