common

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ConfigKey = &contextKey{"config"}
	RepoKey   = &contextKey{"repo"}
)

Keys to use for context.Context.

View Source
var ErrMissingRepo = errors.New("missing repo")

ErrMissingRepo indicates that the requested repository could not be found.

Functions

func CloneCmd

func CloneCmd(publicURL, name string) string

CloneCmd returns the URL of the repository.

func ErrorCmd

func ErrorCmd(err error) tea.Cmd

ErrorCmd returns an ErrorMsg from error.

func RepoURL

func RepoURL(publicURL, name string) string

RepoURL returns the URL of the repository.

func StyleConfig

func StyleConfig() gansi.StyleConfig

StyleConfig returns the default Glamour style configuration.

func TruncateString

func TruncateString(s string, max int) string

TruncateString is a convenient wrapper around truncate.TruncateString.

Types

type Common

type Common struct {
	Width, Height int
	Styles        *styles.Styles
	KeyMap        *keymap.KeyMap
	Zone          *zone.Manager
	Output        *termenv.Output
	Logger        *log.Logger
	// contains filtered or unexported fields
}

Common is a struct all components should embed.

func NewCommon

func NewCommon(ctx context.Context, out *termenv.Output, width, height int) Common

NewCommon returns a new Common struct.

func (*Common) Config

func (c *Common) Config() *config.Config

Config returns the server config.

func (*Common) PublicKey

func (c *Common) PublicKey() ssh.PublicKey

PublicKey returns the public key.

func (*Common) Repo

func (c *Common) Repo() *git.Repository

Repo returns the repository.

func (*Common) SetSize

func (c *Common) SetSize(width, height int)

SetSize sets the width and height of the common struct.

func (*Common) SetValue

func (c *Common) SetValue(key, value interface{})

SetValue sets a value in the context.

type Component

type Component interface {
	tea.Model
	help.KeyMap
	SetSize(width, height int)
}

Component represents a Bubble Tea model that implements a SetSize function.

type ErrorMsg

type ErrorMsg error

ErrorMsg is a Bubble Tea message that represents an error.

Jump to

Keyboard shortcuts

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