profile

package
v0.4.31 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProfileNotFound = errors.New("profile not found")
)

Functions

This section is empty.

Types

type List added in v0.4.17

type List []*Profile

func (List) Names added in v0.4.17

func (l List) Names() []string

func (List) WithNameErr added in v0.4.17

func (l List) WithNameErr(name string) (p *Profile, err error)

type Marker

type Marker struct {
	Mark      string
	NeedLine  bool
	Placement // TODO: 2026-02-26 incomplete
}

Marker are used to provide alignment hints in rulers.

e.g.: | --: | for right alignment

The same alignment, however, may have different representations, depending on the currently active profile.

e.g.: center alignment

psv:        -:-
markdown:   :-:

TODO 2026-02-26 Placement is not currently used to identify floating markers

  • see render/ruler.go

func (Marker) Marks

func (m Marker) Marks() (left, middle, right string)

Marks returns an alignment hint's markers in their relative positions Note: zero Marker returns ("","","")

type Placement

type Placement byte
const (
	PlaceCenter     Placement = 0x0 // 0000 - center alignment
	PlaceRight      Placement = 0x1 // 0001 - right alignment (bound to right edge)
	PlaceFloatRight Placement = 0x2 // 0010 - number alignment (dynamic right-leaning position)
	PlaceFloatLeft  Placement = 0x4 // 0100 - version alignment (dynamic, left-leaning position)
	PlaceLeft       Placement = 0x8 // 1000 - left alignment (bound to right edge)
	PlaceOuter      Placement = 0x9 // 1001 - center alignment (bound to left & right edges)
)

type Profile

type Profile struct {
	Name          string                        // the name of this profile
	Aliases       []string                      // alternative name(s) for this profile
	FlagsMask     column.Flags                  // supported flags by this profile (default: none)
	Replace       map[column.Flags]column.Flags // mapping of unsupported to supported alignment hints
	MinFill       int                           // minimum horizontal line length required per ruler field
	RulerRows     []int                         // where to place rulers during export (default: use table's structure)
	HeaderRow     bool                          // true: first row is never sorted, false: no special treatment for first row
	CollapseEmpty bool                          // if true, empty columns will be shown as ||, otherwise, the MinFill length + padding
	// alignment markers and their positions
	Left    Marker
	Center  Marker
	Right   Marker
	Number  Marker
	Version Marker
}

TODO: 2026-03-06 use same Names []string pattern as keyword.Keyword

func (*Profile) Flags

func (p *Profile) Flags(f column.Flags) column.Flags

Flags masks and maps a set of column flags to the set of flags that are supported by this profile

func (*Profile) Marker

func (p *Profile) Marker(alignment column.Flags) Marker

func (*Profile) RulerConfig added in v0.4.18

func (p *Profile) RulerConfig(rulers overlay.Overlay[ruler.Ruler]) (overlay.Overlay[ruler.Ruler], int)

RulerConfig determines the correct arrangement of rulers for a given profile

A RulerRows value of nil

func (*Profile) String added in v0.4.28

func (p *Profile) String() string

Jump to

Keyboard shortcuts

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