shoutrrr: github.com/containrrr/shoutrrr/pkg/format Index | Files

package format

import "github.com/containrrr/shoutrrr/pkg/format"

Index

Package Files

enum_formatter.go format.go format_colorize.go format_query.go formatter.go

Constants

const EnumInvalid = -1

EnumInvalid is the constant value that an enum gets assigned when it could not be parsed

Variables

var ColorizeDesc = color.New(color.FgHiBlack).SprintFunc()

ColorizeDesc colorizes the input string as "Description"

var ColorizeEnum = color.New(color.FgHiCyan).SprintFunc()

ColorizeEnum colorizes the input string as "Enum"

var ColorizeFalse = color.New(color.FgHiRed).SprintFunc()

ColorizeFalse colorizes the input string as "False"

var ColorizeNumber = color.New(color.FgHiBlue).SprintFunc()

ColorizeNumber colorizes the input string as "Number"

var ColorizeString = color.New(color.FgHiYellow).SprintFunc()

ColorizeString colorizes the input string as "String"

var ColorizeTrue = color.New(color.FgHiGreen).SprintFunc()

ColorizeTrue colorizes the input string as "True"

func BuildQuery Uses

func BuildQuery(c types.ServiceConfig) string

BuildQuery converts the fields of a config object to a delimited query string

func ColorizeValue Uses

func ColorizeValue(value string, isEnum bool) string

ColorizeValue colorizes the input string according to what type appears to be

func CreateEnumFormatter Uses

func CreateEnumFormatter(names []string) types.EnumFormatter

CreateEnumFormatter creates a EnumFormatter struct

func GetConfigFormat Uses

func GetConfigFormat(service types.Service) (reflect.Type, []fieldInfo)

func GetConfigMap Uses

func GetConfigMap(service types.Service) (map[string]string, int)

GetConfigMap returns a string map of a given Config struct

func IsNumber Uses

func IsNumber(value string) bool

IsNumber returns whether the specified string is number-like

func ParseBool Uses

func ParseBool(value string, defaultValue bool) (parsedValue bool, ok bool)

ParseBool returns true for "1","true","yes" or false for "0","false","no" or defaultValue for any other value

func PrintBool Uses

func PrintBool(value bool) string

PrintBool returns "Yes" if value is true, otherwise returns "No"

type EnumFormatter Uses

type EnumFormatter struct {
    // contains filtered or unexported fields
}

EnumFormatter is the helper methods for enum-like types

func (EnumFormatter) Names Uses

func (ef EnumFormatter) Names() []string

Names is the list of the valid Enum string values

func (EnumFormatter) Parse Uses

func (ef EnumFormatter) Parse(s string) int

Parse takes an enum mapped string and returns it's int representation or EnumInvalid (-1)

func (EnumFormatter) Print Uses

func (ef EnumFormatter) Print(e int) string

Print takes a enum mapped int and returns it's string representation or "Invalid"

type NotifyFormat Uses

type NotifyFormat int

NotifyFormat describes the format used in the notification body

const (
    // Markdown is the default notification format
    Markdown NotifyFormat = 0
)

Package format imports 8 packages (graph) and is imported by 8 packages. Updated 2020-11-28. Refresh now. Tools for package owners.