ui

package
v0.0.0-...-16c5621 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2022 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProgram

func NewProgram(cfg Config) *tea.Program

NewProgram returns a new Tea program.

Types

type Config

type Config struct {
	ShowAllFiles    bool
	Gopath          string `env:"GOPATH"`
	HomeDir         string `env:"HOME"`
	GlamourMaxWidth uint
	GlamourStyle    string
	EnableMouse     bool

	// Which directory should we start from?
	WorkingDirectory string

	// Which document types shall we show?
	DocumentTypes DocTypeSet

	// For debugging the UI
	Logfile              string `env:"GLOW_LOGFILE"`
	HighPerformancePager bool   `env:"GLOW_HIGH_PERFORMANCE_PAGER" default:"true"`
	GlamourEnabled       bool   `env:"GLOW_ENABLE_GLAMOUR" default:"true"`
}

Config contains TUI-specific configuration.

type DocType

type DocType int

DocType represents a type of markdown document.

const (
	NoDocType DocType = iota
	LocalDoc
	StashedDoc
	ConvertedDoc
	NewsDoc
)

Available document types.

func (DocType) String

func (d DocType) String() string

type DocTypeSet

type DocTypeSet map[DocType]struct{}

DocTypeSet is a set (in the mathematic sense) of document types.

func NewDocTypeSet

func NewDocTypeSet(t ...DocType) DocTypeSet

NewDocTypeSet returns a set of document types.

func (*DocTypeSet) Add

func (d *DocTypeSet) Add(t ...DocType) int

Add adds a document type of the set.

func (DocTypeSet) AsSlice

func (d DocTypeSet) AsSlice() (agg []DocType)

AsSlice returns the set as a slice of document types.

func (DocTypeSet) Contains

func (d DocTypeSet) Contains(m ...DocType) bool

Contains returns whether or not the set contains the given DocTypes.

func (DocTypeSet) Difference

func (d DocTypeSet) Difference(t ...DocType) DocTypeSet

Difference return a DocumentType set that does not contain the given types.

func (DocTypeSet) Equals

func (d DocTypeSet) Equals(other DocTypeSet) bool

Equals returns whether or not the two sets are equal.

Jump to

Keyboard shortcuts

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