context

package
v0.5.5-pre.1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2020 License: MIT Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() string

func NewBlank

func NewBlank() *blankContext

NewBlank initializes a blank Context suitable for testing

func ParseDefaultConfig

func ParseDefaultConfig() (*configEntry, error)

ParseDefaultConfig reads the configuration file

Types

type Context

type Context interface {
	AuthToken() (string, error)
	SetAuthToken(string)
	AuthLogin() (string, error)
	Branch() (string, error)
	SetBranch(string)
	Remotes() (Remotes, error)
	BaseRepo() (ghrepo.Interface, error)
	SetBaseRepo(string)
}

Context represents the interface for querying information about the current environment

func New

func New() Context

New initializes a Context that reads from the filesystem

type Remote

type Remote struct {
	*git.Remote
	Owner string
	Repo  string
}

Remote represents a git remote mapped to a GitHub repository

func (Remote) RepoName

func (r Remote) RepoName() string

RepoName is the name of the GitHub repository

func (Remote) RepoOwner

func (r Remote) RepoOwner() string

RepoOwner is the name of the GitHub account that owns the repo

type Remotes

type Remotes []*Remote

Remotes represents a set of git remotes

func (Remotes) FindByName

func (r Remotes) FindByName(names ...string) (*Remote, error)

FindByName returns the first Remote whose name matches the list

func (Remotes) FindByRepo

func (r Remotes) FindByRepo(owner, name string) (*Remote, error)

FindByRepo returns the first Remote that points to a specific GitHub repository

func (Remotes) Len

func (r Remotes) Len() int

https://golang.org/pkg/sort/#Interface

func (Remotes) Less

func (r Remotes) Less(i, j int) bool

func (Remotes) Swap

func (r Remotes) Swap(i, j int)

Jump to

Keyboard shortcuts

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