application

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package application run the application

Package application run the application

Package application run the application

Package application run the application

Package application run the application

Package application run the application

Package application run the application

Package application run the application

Package application run the application

Package application run the application

Package application run the application

Package application run the application

Package application run the application

Package application run the application

Package application run the application

Package application run the application

Package application run the application

Package application run the application

Index

Constants

View Source
const (
	// ColorDefault represents default color (no color)
	ColorDefault string = "default"

	// ColorRed represents red color
	ColorRed string = "red"
	// ColorGreen represents green color
	ColorGreen string = "green"
	// ColorBlue represents blue color
	ColorBlue string = "blue"
	// ColorYellow represents yellow color
	ColorYellow string = "yellow"
	// ColorMagenta represents magenta color
	ColorMagenta string = "magenta"
	// ColorCyan represents cyan color
	ColorCyan string = "cyan"
	// ColorWhite represents white color
	ColorWhite string = "white"
	// ColorBlack represents black color
	ColorBlack string = "black"

	// ColorHiRed represents high intensity red color
	ColorHiRed string = "hiRed"
	// ColorHiGreen represents high intensity green color
	ColorHiGreen string = "hiGreen"
	// ColorHiBlue represents high intensity blue color
	ColorHiBlue string = "hiBlue"
	// ColorHiYellow represents high intensity yellow color
	ColorHiYellow string = "hiYellow"
	// ColorHiMagenta represents high intensity magenta color
	ColorHiMagenta string = "hiMagenta"
	// ColorHiCyan represents high intensity cyan color
	ColorHiCyan string = "hiCyan"
	// ColorHiWhite represents high intensity white color
	ColorHiWhite string = "hiWhite"
	// ColorHiBlack represents high intensity black color
	ColorHiBlack string = "hiBlack"

	// ColorBgRed represents red background color
	ColorBgRed string = "bgRed"
	// ColorBgGreen represents green background color
	ColorBgGreen string = "bgGreen"
	// ColorBgBlue represents blue background color
	ColorBgBlue string = "bgBlue"
	// ColorBgYellow represents yellow background color
	ColorBgYellow string = "bgYellow"
	// ColorBgMagenta represents magenta background color
	ColorBgMagenta string = "bgMagenta"
	// ColorBgCyan represents cyan background color
	ColorBgCyan string = "bgCyan"
	// ColorBgWhite represents white background color
	ColorBgWhite string = "bgWhite"
	// ColorBgBlack represents black background color
	ColorBgBlack string = "bgBlack"

	// ColorHiBgRed represents high intensity red background color
	ColorHiBgRed string = "hiBgRed"
	// ColorHiBgGreen represents high intensity green background color
	ColorHiBgGreen string = "hiBgGreen"
	// ColorHiBgBlue represents high intensity blue background color
	ColorHiBgBlue string = "hiBgBlue"
	// ColorHiBgYellow represents high intensity yellow background color
	ColorHiBgYellow string = "hiBgYellow"
	// ColorHiBgMagenta represents high intensity magenta background color
	ColorHiBgMagenta string = "hiBgMagenta"
	// ColorHiBgCyan represents high intensity cyan background color
	ColorHiBgCyan string = "hiBgCyan"
	// ColorHiBgWhite represents high intensity white background color
	ColorHiBgWhite string = "hiBgWhite"
	// ColorHiBgBlack represents high intensity black background color
	ColorHiBgBlack string = "hiBgBlack"

	// ColorBold represents bold text
	ColorBold string = "bold"
	// ColorFaint represents faint text
	ColorFaint string = "faint"
	// ColorItalic represents italic text
	ColorItalic string = "italic"
	// ColorUnderline represents underlined text
	ColorUnderline string = "underline"
	// ColorBlinkSlow represents slow blinking text
	ColorBlinkSlow string = "blinkSlow"
	// ColorBlinkRapid represents rapid blinking text
	ColorBlinkRapid string = "blinkRapid"
	// ColorReverseVideo represents reverse video text
	ColorReverseVideo string = "reverseVideo"
	// ColorConcealed represents concealed text
	ColorConcealed string = "concealed"
	// ColorCrossedOut represents crossed out text
	ColorCrossedOut string = "crossedOut"
)

Variables

View Source
var DefaultAlignment = AlignLeft

DefaultAlignment is the default text alignment (left)

View Source
var DefaultTextColor = TextColorSpec{
	Type: colorTypeFixed, Default: StringList{ColorDefault},
}

DefaultTextColor is the default color (no color)

Functions

func PrintTable

func PrintTable(spec *Spec, fullData interface{}) error

PrintTable prints JSON data in tabular format based on the provided specification

func Run

func Run(args []string) error

Run start application

Types

type Alignment added in v0.3.0

type Alignment string

Alignment represents text alignment in a column

const (
	// AlignLeft aligns text to the left
	AlignLeft Alignment = "left"
	// AlignRight aligns text to the right
	AlignRight Alignment = "right"
	// AlignCenter aligns text to the center
	AlignCenter Alignment = "center"
)

type Arguments

type Arguments struct {
	SpecFile string
	DataFile string
	EnvSpec  string
	Columns  string
}

Arguments holds the parsed CLI arguments

func ParseArguments

func ParseArguments(c *cli.Command) (Arguments, error)

ParseArguments parses CLI arguments, validates them into an Arguments struct

type Column

type Column struct {
	Path     StringList    `json:"path" validate:"required"`
	Title    string        `json:"title"`
	MinWidth int           `json:"minWidth" validate:"min=0,ltefield=MaxWidth"`
	MaxWidth int           `json:"maxWidth" validate:"min=0,gtefield=MinWidth"`
	Align    Alignment     `json:"align" validate:"omitempty,oneof=left right center"`
	URLPath  string        `json:"urlPath"`
	Color    TextColorSpec `json:"color"`

	Width int
}

Column represents a column specification

type Spec

type Spec struct {
	DataPath string   `json:"dataPath"`
	Columns  []Column `json:"columns" validate:"required,min=1,dive"`
}

Spec represents the specification structure

type StringList added in v0.6.0

type StringList []string

StringList is a custom type that can unmarshal from either a string or []string

func (*StringList) UnmarshalJSON added in v0.6.0

func (s *StringList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler for StringList

type TextColorSpec added in v0.6.0

type TextColorSpec struct {
	Type       colorType
	Default    StringList `json:"default"`
	Conditions []struct {
		When  StringList `json:"when"`
		Color StringList `json:"color"`
	} `json:"conditions"`
}

TextColorSpec represents text color specification

func (*TextColorSpec) UnmarshalJSON added in v0.6.0

func (s *TextColorSpec) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler for TextColorSpec

Jump to

Keyboard shortcuts

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