segment

package
v0.0.0-...-fb30631 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package segment defines all segments and exposes an unique way to provide them.

Index

Constants

View Source
const (
	// SegmentNameUnknown defines the segment name to use for failure.
	SegmentNameUnknown = ""
	// SegmentNameStub defines the segment name to use for stub.
	SegmentNameStub = "-stub-"
)

Variables

This section is empty.

Functions

func ProvideSegments

func ProvideSegments(segments []string, cfg Config) ([]domain.SegmentsProvider, error)

ProvideSegments provides segments based on configuration.

Types

type Config

type Config struct {
	Stub   StubConfig              `yaml:"-"`
	Custom map[string]customConfig `yaml:"custom"`

	CWD               cwdConfig               `yaml:"cwd"`
	GIT               gitConfig               `yaml:"git"`
	Msg               msgConfig               `yaml:"msg"`
	K8S               k8sConfig               `yaml:"k8s"`
	LastCMDExecStatus lastCMDExecStatusConfig `yaml:"last-cmd-exec-status"`
	LastCMDExecTime   lastCMDExecTimeConfig   `yaml:"last-cmd-exec-time"`
	ReadOnly          readOnlyConfig          `yaml:"read-only"`
	User              userConfig              `yaml:"user"`
}

Config stores the configuration for all segments provider.

type StubConfig

type StubConfig struct {
	Segments domain.Segments
	Error    error
}

StubConfig stores the results to return when calling the ProvideSegments method.

Jump to

Keyboard shortcuts

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