hat

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Hat

This is a fork of owenthereal/ccat.

The goal is to provide the same functionality, but as a Go package instead of as a utility.

Supported Languages

  • C
  • Go
  • JSON
  • Java
  • JavaScript
  • Python
  • Ruby

Thanks to

General information

  • License: MIT
  • Version: 1.1.0

Documentation

Index

Constants

View Source
const Version = "1.1.0"

Variables

View Source
var (
	LightColorPalettes = ColorPalettes{
						// contains filtered or unexported fields
	}

	DarkColorPalettes = ColorPalettes{
						// contains filtered or unexported fields
	}

	Mode mode.Mode = mode.C
)

Functions

func CCat

func CCat(fname string, p CCatPrinter, w io.Writer) error

func CPrint

func CPrint(r io.Reader, w io.Writer, palettes ColorPalettes) error

func Colorize

func Colorize(attr, text string) string

Format “text“ with a color and/or some attributes::

color       normal color
*color*     bold color
_color_     underlined color
+color+     blinking color

func HTMLize

func HTMLize(attr, text string) string

Types

type AutoColorPrinter

type AutoColorPrinter struct {
	ColorPalettes ColorPalettes
}

func (AutoColorPrinter) Print

func (a AutoColorPrinter) Print(r io.Reader, w io.Writer) error

type CCatPrinter

type CCatPrinter interface {
	Print(r io.Reader, w io.Writer) error
}

type ColorCodes

type ColorCodes map[string]string

func (ColorCodes) String

func (c ColorCodes) String() string

type ColorPalettes

type ColorPalettes map[kind]string

func (ColorPalettes) Get

func (c ColorPalettes) Get(k syntax.Kind) string

func (ColorPalettes) Set

func (c ColorPalettes) Set(k, v string) bool

func (ColorPalettes) String

func (c ColorPalettes) String() string

type ColorPrinter

type ColorPrinter struct {
	ColorPalettes ColorPalettes
}

func (ColorPrinter) Print

func (c ColorPrinter) Print(r io.Reader, w io.Writer) error

type Config added in v1.1.0

type Config struct {
	ColorCodes  mapValue
	BG          string
	Color       string
	HTML        bool
	ShowPalette bool
	ShowVersion bool
	Mode        mode.Mode
}

func New added in v1.1.0

func New() *Config

func (*Config) Cat added in v1.1.0

func (c *Config) Cat(filename string) error

func (*Config) Run added in v1.1.0

func (c *Config) Run(args []string) error

type HTMLCodes

type HTMLCodes map[string]string

func (HTMLCodes) String

func (c HTMLCodes) String() string

type PlainTextPrinter

type PlainTextPrinter struct {
}

func (PlainTextPrinter) Print

func (p PlainTextPrinter) Print(r io.Reader, w io.Writer) error

type Printer

type Printer struct {
	ColorPalettes ColorPalettes
}

func (Printer) Print

func (p Printer) Print(w io.Writer, kind syntax.Kind, tokText string) error

Directories

Path Synopsis
cmd
hat command

Jump to

Keyboard shortcuts

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