reportstyle

package module
v0.1.22 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: BSD-3-Clause Imports: 1 Imported by: 10

README

OVERVIEW

Go Reference Go Report Card Go Build

paepcke.de/reportstyle

Internal Package for uniform reporting across *info packages.

  • enables uniform data reports look & feel for:

    • plaintext
    • ansi color terminal
    • markdown
    • html
  • supported packages:

    • paepcke.de/dnsinfo
    • paepcke.de/certinfo
    • paepcke.de/tlsinfo
    • ...

DOCS

pkg.go.dev/paepcke.de/reportstyle

CONTRIBUTION

Yes, Please! PRs Welcome!

Documentation

Overview

package reportstyle

Index

Constants

View Source
const (
	// ascii string token
	Linefeed  = "\n"
	Space     = " "
	Empty     = ""
	Separator = " : "
	Ok        = "[OK]"
	Valid     = "[VALID]"
	Fail      = "[FAIL]"
	Alert     = "[ALERT]"
	// ansi color terminal
	AnsiRed     = "\033[2;91m"
	AnsiGreen   = "\033[2;92m"
	AnsiYellow  = "\033[2;93m"
	AnsiBlue    = "\033[2;94m"
	AnsiMagenta = "\033[2;95m"
	AnsiCyan    = "\033[2;96m"
	AnsiWhite   = "\033[2;97m"
	AnsiGrey    = "\033[2;90m"
	AnsiEnd     = "\033[0m"
	// html color
	HtmlRed   = "<a style=\"color:#FF0000\"><strong>"
	HtmlGreen = "<a style=\"color:#00FF00\"><strong>"
	HtmlEnd   = "</strong></a>"
)

const

Variables

This section is empty.

Functions

This section is empty.

Types

type Style

type Style struct {
	Raw      bool                // add raw datasets
	Start    string              // start object with
	End      string              // end object with
	Ok       string              // string Ok statement
	Valid    string              // strong valid statement
	Fail     string              // strong fail statement
	Alert    string              // strong alert statement
	L1       string              // table start & style 1
	L2       string              // table style 2
	L3       string              // table style 3 ( multiline style 2  )
	L4       string              // table style 4
	LE       string              // table end
	PS       string              // preformated start
	PE       string              // preformated end
	SaniFunc func(string) string // sanitizer function for preformated blocks
}

Style defines the output style, feel free to design your own within your app, see example defaults below

func StyleAnsi

func StyleAnsi() *Style

StyleAnsi ... Returns as example a Ansi Color Terminal Report Style

func StyleHTML

func StyleHTML() *Style

StyleHTML ... Returns as example a HTML/CSS Report Style for usage with any google compatible syntax highlighter css stylesheet

func StyleMarkdown

func StyleMarkdown() *Style

StyleMarkdown ... Returns as example a [gh] Markdown Report Style

func StyleNone

func StyleNone() *Style

StyleNone ... Returns a Default empty Style

func StylePlain

func StylePlain() *Style

StylePlain ... Returns a Default Plain Text Report Style [currently:alias]

func StyleText

func StyleText() *Style

StyleText ... Returns as example a Ascii Plain Text Report Style

Jump to

Keyboard shortcuts

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