Documentation ¶
Index ¶
- Constants
- func Describe(d Describable, resp *http.Response, err error)
- func Error(err error) string
- func HTTPDisplay(resp *http.Response, err error)
- func InitTerm()
- func List(d Listable, resp *http.Response, err error)
- func LocString(d int) string
- func Pef()
- func Pxf()
- type ColorSprintfFunc
- type Describable
- type Listable
- type Message
- type Profile
- type ProfileList
Constants ¶
const ( ScreenNoColorDefaultKey = "termtextNoColor" // No Color profile ScreenDarkDefaultKey = "termtextDarkDefault" // Dark Profile ScreenLightDefaultKey = "termtextLightDefault" // Light Profile )
Values
const JSONDisplayKey = "Termtext.JSONDisplay" // bool
JSONDisplayKey controls output. If set only JSON is displayed for renders which have response objects. For example, in a yaml configuration file you can set: Termtext:
JSONDisplay: True
const (
ScreenProfileKey = "Termtext.screenProfile" // Viper Key for profile name - string
)
Variables
Variables ¶
This section is empty.
Functions ¶
func Describe ¶
func Describe(d Describable, resp *http.Response, err error)
Describe provides detailed output on the object.
func HTTPDisplay ¶
HTTPDisplay - This is for the HTTP direct commands.
func List ¶
List and Describe display their objects by calling render, but first checking that an object is there. If not they send along an empty function for the descoroator to call.
func LocString ¶
LocString string for function and file location of depth d. 0 is depth of the function calling LocString, 1 is the callers caller etc.
Types ¶
type ColorSprintfFunc ¶
ColorSprintfFunc use this with github.com/juju/ansi term to get a TabWriter that works with color.
var ( Title ColorSprintfFunc SubTitle ColorSprintfFunc Text ColorSprintfFunc Info ColorSprintfFunc Highlight ColorSprintfFunc Success ColorSprintfFunc Warn ColorSprintfFunc Fail ColorSprintfFunc Alert ColorSprintfFunc )
I think I like this better than setting up function calls that map to a wrapper around the function call off of ScreenProfile eg.
func Title(s string, args ...interface{}) string { ScreenProfile.Title( ...... ) }
It's true the set up is more expensive, but it does remove a function call from the execution path ......
These are used to surround strings with color. e.g. fmt.Printf(t.Title("This is a title")) or fmt.Printf("%s: %s.", t.Alert("Houston we have a problem"), t.Text("is not what was actually said"))
type Profile ¶
type Profile struct {
Name, Key string // Name for display, Key for dictionary and viper
Title, SubTitle, Text ColorSprintfFunc // Basic text formating
Info, Highlight ColorSprintfFunc // Some semantic formats
Success, Warn, Fail, Alert ColorSprintfFunc // Alert style formats.
}
type ProfileList ¶
type ProfileList []ProfileList