shellformat

package
v4.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fmt

func Fmt(format Format, input string, a ...any) string

Fmt modifies the provided string using the list of modifiers and resets the output formatting to default at the end

Types

type EscapeSeq

type EscapeSeq = string

EscapeSeq denotes a simple formatting modifier / escape sequence for shell output

var (
	EscapeSeqReset  EscapeSeq = "\033[0m"
	EscapeSeqBold   EscapeSeq = "\033[1m"
	EscapeSeqBlack  EscapeSeq = "\033[30m"
	EscapeSeqRed    EscapeSeq = "\033[31m"
	EscapeSeqGreen  EscapeSeq = "\033[32m"
	EscapeSeqYellow EscapeSeq = "\033[33m"
	EscapeSeqBlue   EscapeSeq = "\033[34m"
	EscapeSeqPurple EscapeSeq = "\033[35m"
	EscapeSeqCyan   EscapeSeq = "\033[36m"
	EscapeSeqGray   EscapeSeq = "\033[37m"
	EscapeSeqWhite  EscapeSeq = "\033[97m"
)

Some standard modifiers

type Format

type Format uint64

Format denotes an abstract format for shell output

const (
	Bold   Format = 1 << 1
	Black  Format = 1 << 2
	Red    Format = 1 << 3
	Green  Format = 1 << 4
	Yellow Format = 1 << 5
	Blue   Format = 1 << 6
	Purple Format = 1 << 7
	Cyan   Format = 1 << 8
	Gray   Format = 1 << 9
	White  Format = 1 << 10
)

Formatting codes suitable for logical combination via '|'

Jump to

Keyboard shortcuts

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