stack

package
v0.0.0-...-49692ae Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeBase

func MergeBase(env CmdEnv, refA, refB string) (string, error)

func ParseCommitUID

func ParseCommitUID(input string) (string, error)

Types

type CmdEnv

type CmdEnv struct {
	Dir    string
	Env    []string
	Logger *slog.Logger
}

func (CmdEnv) Run

func (e CmdEnv) Run(command ...string) (string, error)

func (CmdEnv) RunMulti

func (e CmdEnv) RunMulti(cmds ...[]string) error

type Config

type Config struct {
	// Verbose enables verbose logging, defaults to false.
	Verbose bool `yaml:"verbose"`
	// LocalHead is a git reference to the local top of the stack, defaults to "HEAD".
	LocalHead string `yaml:"local_head"`
	// RemoteHost is the name of the remote host, defaults to "github.com".
	RemoteHost string `yaml:"remote_host"`
	// RemoteName is the name of the remote repository to target,
	// defaults to "origin".
	RemoteName string `yaml:"remote_name"`
	// RemoteHead is the name of the remote branch to target,
	// defaults to "main".
	RemoteHead string `yaml:"remote_head"`
	// GithubOAuthToken holds the github OAuth token. Uses the gh cli token if
	// available.
	GithubOAuthToken string `yaml:""`
	// RemoteOwner is the name of the owner (user or org) of the remote
	// repository.
	RemoteOwner string `yaml:"remote_host"`
	// RemoteRepo is the name of the remote repository.
	RemoteRepo string `yaml:"remote_host"`
}

func (*Config) Load

func (c *Config) Load(ctx *Context) error

func (Config) RemoteRef

func (c Config) RemoteRef() string

func (Config) WithDefaults

func (c Config) WithDefaults() Config

type Context

type Context struct {
	// contains filtered or unexported fields
}

type ContextOptions

type ContextOptions struct {
	// Dir is the directory to operate in
	Dir string
	// Verbose enables verbose logging.
	Verbose bool
	// LoadConfig determines if the context should load its config from disk.
	LoadConfig bool
	// LoadGithubCredentials determines if the github credentials should be
	// loaded automatically.
	LoadGithub bool
}

func (ContextOptions) NewContext

func (o ContextOptions) NewContext() (*Context, error)

type GitCommit

type GitCommit struct {
	// Hash is the git commit hash.
	Hash string
	// UID is the value of the Commit-UID trailer.
	UID string
	// Message string
	Message string
}

func GitLog

func GitLog(env CmdEnv, args ...string) ([]*GitCommit, error)

func (GitCommit) Branch

func (g GitCommit) Branch() string

func (GitCommit) Oneline

func (g GitCommit) Oneline() string

type LocalStack

type LocalStack struct {
	Commits []*GitCommit
}

func (*LocalStack) Load

func (l *LocalStack) Load(c *Context) (err error)

Load populates the local stack according to the config.

type PullRequest

type PullRequest struct {
	ID    string
	Title string
	Body  string
	Head  string
	Base  string
	URL   string
}

func (*PullRequest) LoadBranch

func (p *PullRequest) LoadBranch(c *Context, branch string) error

type RemoteStack

type RemoteStack struct {
	UID     string
	Branch  string
	Commits []*GitCommit
}

type RemoteStacks

type RemoteStacks struct {
	Stacks []*RemoteStack
}

func (*RemoteStacks) Load

func (r *RemoteStacks) Load(c *Context, ls *LocalStack) error

type StatusItem

type StatusItem struct {
	UID         string
	Oneline     string
	LocalCommit *GitCommit
	RemoteStack *RemoteStack
	PullRequest *PullRequest
}

type StatusStack

type StatusStack struct {
	LocalStack   LocalStack
	RemoteStacks RemoteStacks
	StatusItems  []*StatusItem
}

func (*StatusStack) Load

func (s *StatusStack) Load(c *Context) error

func (*StatusStack) String

func (s *StatusStack) String() string

Jump to

Keyboard shortcuts

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