Documentation ¶
Index ¶
- Constants
- Variables
- func FormatFullFilePath(p Project) (string, error)
- func FormatJSON(p Project) (string, error)
- func FormatRelFilePath(p Project) (string, error)
- func FormatRelPath(p Project) (string, error)
- func FormatURL(p Project) (string, error)
- func ValidateHost(h string) error
- func ValidateName(name string) error
- func ValidateOwner(owner string) error
- type ErrInvalidHost
- type ErrInvalidName
- type ErrInvalidOwner
- type Format
- type LocalCloneOption
- type LocalController
- func (l *LocalController) Clone(ctx context.Context, spec Spec, server Server, opt *LocalCloneOption) (Project, error)
- func (l *LocalController) Create(ctx context.Context, spec Spec, _ *LocalCreateOption) (Project, error)
- func (l *LocalController) Delete(ctx context.Context, spec Spec, _ *LocalDeleteOption) error
- func (l *LocalController) GetRemoteURLs(ctx context.Context, spec Spec, name string) ([]string, error)
- func (l *LocalController) List(ctx context.Context, option *LocalListOption) ([]Project, error)
- func (l *LocalController) SetRemoteSpecs(ctx context.Context, spec Spec, remotes map[string][]Spec) error
- func (l *LocalController) SetRemoteURLs(ctx context.Context, spec Spec, remotes map[string][]string) error
- func (l *LocalController) Walk(ctx context.Context, option *LocalWalkOption, walkFn LocalWalkFunc) error
- type LocalCreateOption
- type LocalDeleteOption
- type LocalListOption
- type LocalWalkFunc
- type LocalWalkOption
- type Project
- func (p Project) CheckEntity() error
- func (p Project) FullFilePath() string
- func (p Project) FullLevels() []string
- func (p Project) Host() string
- func (p Project) Name() string
- func (p Project) Owner() string
- func (p Project) RelFilePath() string
- func (p Project) RelLevels() []string
- func (p Project) RelPath() string
- func (p Project) Root() string
- func (p Project) Spec() Spec
- func (p Project) URL() string
- type RemoteController
- func (c *RemoteController) Create(ctx context.Context, name string, option *RemoteCreateOption) (Spec, error)
- func (c *RemoteController) CreateFromTemplate(ctx context.Context, templateOwner, templateName, name string, ...) (Spec, error)
- func (c *RemoteController) Delete(ctx context.Context, owner string, name string, _ *RemoteDeleteOption) error
- func (c *RemoteController) Fork(ctx context.Context, owner string, name string, option *RemoteForkOption) (Spec, error)
- func (c *RemoteController) Get(ctx context.Context, owner string, name string, _ *RemoteGetOption) (Spec, error)
- func (c *RemoteController) GetParent(ctx context.Context, owner string, name string, _ *RemoteParentOption) (Spec, error)
- func (c *RemoteController) GetSource(ctx context.Context, owner string, name string, _ *RemoteSourceOption) (Spec, error)
- func (c *RemoteController) List(ctx context.Context, option *RemoteListOption) (allSpecs []Spec, _ error)
- func (c *RemoteController) ListAsync(ctx context.Context, option *RemoteListOption) (<-chan Spec, <-chan error)
- func (c *RemoteController) ListByOrg(ctx context.Context, org string, option *RemoteListByOrgOption) (allSpecs []Spec, _ error)
- func (c *RemoteController) ListByOrgAsync(ctx context.Context, org string, option *RemoteListByOrgOption) (<-chan Spec, <-chan error)
- type RemoteCreateFromTemplateOption
- type RemoteCreateOption
- type RemoteDeleteOption
- type RemoteForkOption
- type RemoteGetOption
- type RemoteListByOrgOption
- type RemoteListOption
- type RemoteParentOption
- type RemoteSourceOption
- type Server
- type Servers
- func (s *Servers) Default() (Server, error)
- func (s *Servers) Find(host string) (Server, error)
- func (s *Servers) List() (list []Server, _ error)
- func (s Servers) MarshalYAML() (interface{}, error)
- func (s *Servers) Remove(host string) error
- func (s *Servers) Set(host, user, token string) error
- func (s *Servers) SetDefault(host string) error
- func (s *Servers) UnmarshalYAML(unmarshaler func(interface{}) error) error
- type Spec
- type SpecParser
Constants ¶
const (
DefaultHost = github.DefaultHost
)
const DefaultRootDirName = "Projects"
Variables ¶
var ( ErrNoServer = errors.New("no server registered") ErrServerNotFound = errors.New("server not found") ErrUnremovableServer = errors.New("default server is not able to be removed") )
var ( ErrEmptyHost = ErrInvalidHost("empty host") ErrEmptyOwner = ErrInvalidOwner("empty owner") ErrEmptyName = ErrInvalidName("empty name") )
var (
ErrTooManySlashes = errors.New("too many slashes")
)
Functions ¶
func FormatFullFilePath ¶
func FormatJSON ¶ added in v2.0.5
func FormatRelFilePath ¶
func FormatRelPath ¶
func ValidateHost ¶
func ValidateName ¶
func ValidateOwner ¶
Types ¶
type ErrInvalidHost ¶
type ErrInvalidHost string
func (ErrInvalidHost) Error ¶
func (e ErrInvalidHost) Error() string
type ErrInvalidName ¶
type ErrInvalidName string
func (ErrInvalidName) Error ¶
func (e ErrInvalidName) Error() string
type ErrInvalidOwner ¶
type ErrInvalidOwner string
func (ErrInvalidOwner) Error ¶
func (e ErrInvalidOwner) Error() string
type Format ¶
func FormatFields ¶
type LocalCloneOption ¶
type LocalCloneOption struct {
Alias *Spec
}
type LocalController ¶
type LocalController struct {
// contains filtered or unexported fields
}
func NewLocalController ¶
func NewLocalController(root string) *LocalController
func (*LocalController) Clone ¶
func (l *LocalController) Clone(ctx context.Context, spec Spec, server Server, opt *LocalCloneOption) (Project, error)
func (*LocalController) Create ¶
func (l *LocalController) Create(ctx context.Context, spec Spec, _ *LocalCreateOption) (Project, error)
func (*LocalController) Delete ¶
func (l *LocalController) Delete(ctx context.Context, spec Spec, _ *LocalDeleteOption) error
func (*LocalController) GetRemoteURLs ¶
func (*LocalController) List ¶
func (l *LocalController) List(ctx context.Context, option *LocalListOption) ([]Project, error)
func (*LocalController) SetRemoteSpecs ¶ added in v2.1.0
func (*LocalController) SetRemoteURLs ¶
func (*LocalController) Walk ¶
func (l *LocalController) Walk(ctx context.Context, option *LocalWalkOption, walkFn LocalWalkFunc) error
type LocalCreateOption ¶
type LocalCreateOption struct { }
type LocalDeleteOption ¶
type LocalDeleteOption struct{}
type LocalListOption ¶
type LocalListOption struct {
Query string
}
type LocalWalkFunc ¶
type LocalWalkOption ¶
type LocalWalkOption struct {
Query string
}
type Project ¶
type Project struct {
// contains filtered or unexported fields
}
Project is the location of a repository in the local. It is a valid location, that never means "exist".
func NewProject ¶
func (Project) CheckEntity ¶
CheckEntity checks the project is exist in the local file-system.
func (Project) FullFilePath ¶
func (Project) FullLevels ¶
func (Project) RelFilePath ¶
type RemoteController ¶
type RemoteController struct {
// contains filtered or unexported fields
}
func NewRemoteController ¶
func NewRemoteController(adaptor github.Adaptor) *RemoteController
func (*RemoteController) Create ¶
func (c *RemoteController) Create(ctx context.Context, name string, option *RemoteCreateOption) (Spec, error)
func (*RemoteController) CreateFromTemplate ¶ added in v2.1.4
func (c *RemoteController) CreateFromTemplate(ctx context.Context, templateOwner, templateName, name string, option *RemoteCreateFromTemplateOption) (Spec, error)
func (*RemoteController) Delete ¶
func (c *RemoteController) Delete(ctx context.Context, owner string, name string, _ *RemoteDeleteOption) error
func (*RemoteController) Fork ¶
func (c *RemoteController) Fork(ctx context.Context, owner string, name string, option *RemoteForkOption) (Spec, error)
func (*RemoteController) Get ¶
func (c *RemoteController) Get(ctx context.Context, owner string, name string, _ *RemoteGetOption) (Spec, error)
func (*RemoteController) GetParent ¶ added in v2.1.0
func (c *RemoteController) GetParent(ctx context.Context, owner string, name string, _ *RemoteParentOption) (Spec, error)
func (*RemoteController) GetSource ¶ added in v2.1.0
func (c *RemoteController) GetSource(ctx context.Context, owner string, name string, _ *RemoteSourceOption) (Spec, error)
func (*RemoteController) List ¶
func (c *RemoteController) List(ctx context.Context, option *RemoteListOption) (allSpecs []Spec, _ error)
func (*RemoteController) ListAsync ¶ added in v2.0.10
func (c *RemoteController) ListAsync(ctx context.Context, option *RemoteListOption) (<-chan Spec, <-chan error)
func (*RemoteController) ListByOrg ¶
func (c *RemoteController) ListByOrg(ctx context.Context, org string, option *RemoteListByOrgOption) (allSpecs []Spec, _ error)
func (*RemoteController) ListByOrgAsync ¶ added in v2.0.10
func (c *RemoteController) ListByOrgAsync(ctx context.Context, org string, option *RemoteListByOrgOption) (<-chan Spec, <-chan error)
type RemoteCreateFromTemplateOption ¶ added in v2.1.4
type RemoteCreateOption ¶
type RemoteCreateOption struct { // Organization is the name of the organization that owns the repository. Organization string // Description is a short description of the repository. Description string // Homepage is a URL with more information about the repository. Homepage string // Visibility can be public or private. If your organization is associated with an enterprise account using GitHub // Enterprise Cloud or GitHub Enterprise Server 2.20+, visibility can also be internal. For more information, see // "Creating an internal repository" in the GitHub Help documentation. The visibility parameter overrides the private // parameter when you use both parameters with the nebula-preview preview header. Visibility string // DisableIssues is either false to enable issues for this repository or true to disable them. DisableIssues bool // DisableProjects is either false to enable projects for this repository or true to disable them. Note: If you're // creating a repository in an organization that has disabled repository projects, the default is false, and if you // pass true, the API returns an error. DisableProjects bool // DisableWiki is either false to enable the wiki for this repository or true to disable it. DisableWiki bool // DisableDownloads is either false to enable the downloads or true to disable it. DisableDownloads bool // IsTemplate is either true to make this repo available as a template repository or false to prevent it. IsTemplate bool // TeamID is the id of the team that will be granted access to this repository. This is only valid when creating a // repository in an organization. TeamID int64 // AutoInit is pass true to create an initial commit with empty README. AutoInit bool // GitignoreTemplate is the desired language or platform .gitignore template to apply. Use the name of the template // without the extension. For example, "Haskell". GitignoreTemplate string // LicenseTemplate is an open source license template, and then use the license keyword as the licenseTemplate string. // For example, "mit" or "mpl-2.0". LicenseTemplate string // PreventSquashMerge is either false to allow squash-merging pull requests, or true to prevent squash-merging. PreventSquashMerge bool // PreventMergeCommit is either false to allow merging pull requests with a merge commit, or true to prevent merging // pull requests with merge commits. PreventMergeCommit bool // PreventRebaseMerge is either false to allow rebase-merging pull requests, or true to prevent rebase-merging. PreventRebaseMerge bool // DeleteBranchOnMerge is either true to allow automatically deleting head branches when pull requests are merged, or // false to prevent automatic deletion. DeleteBranchOnMerge bool }
func (*RemoteCreateOption) GetOrganization ¶
func (o *RemoteCreateOption) GetOrganization() string
type RemoteDeleteOption ¶
type RemoteDeleteOption struct{}
type RemoteForkOption ¶
type RemoteForkOption struct { // Organization is the name of the organization that owns the repository. Organization string }
func (*RemoteForkOption) GetOptions ¶
func (o *RemoteForkOption) GetOptions() *github.RepositoryCreateForkOptions
type RemoteGetOption ¶
type RemoteGetOption struct{}
type RemoteListByOrgOption ¶
type RemoteListByOrgOption struct { Query string // Type of repositories to list. Possible values are: all, public, private, // forks, sources, member. Default is "all". Type string // How to sort the repository list. Can be one of created, updated, pushed, // full_name. Default is "created". Sort string // Direction in which to sort repositories. Can be one of asc or desc. // Default when using full_name: asc; otherwise desc. Direction string }
func (*RemoteListByOrgOption) GetOptions ¶
func (o *RemoteListByOrgOption) GetOptions() *github.RepositoryListByOrgOptions
func (*RemoteListByOrgOption) GetQuery ¶
func (o *RemoteListByOrgOption) GetQuery() string
type RemoteListOption ¶
type RemoteListOption struct { User string Query string // Visibility of repositories to list. Can be one of all, public, or private. // Default: all Visibility string // List repos of given affiliation[s]. // Comma-separated list of values. Can include: // * owner: Repositories that are owned by the authenticated user. // * collaborator: Repositories that the user has been added to as a // collaborator. // * organization_member: Repositories that the user has access to through // being a member of an organization. This includes every repository on // every team that the user is on. // Default: owner,collaborator,organization_member Affiliation string // Type of repositories to list. // Can be one of all, owner, public, private, member. Default: all // Will cause a 422 error if used in the same request as visibility or // affiliation. Type string // How to sort the repository list. Can be one of created, updated, pushed, // full_name. Default: full_name Sort string // Direction in which to sort repositories. Can be one of asc or desc. // Default: when using full_name: asc; otherwise desc Direction string }
func (*RemoteListOption) GetOptions ¶
func (o *RemoteListOption) GetOptions() *github.RepositoryListOptions
func (*RemoteListOption) GetQuery ¶
func (o *RemoteListOption) GetQuery() string
func (*RemoteListOption) GetUser ¶
func (o *RemoteListOption) GetUser() string
type RemoteParentOption ¶ added in v2.1.0
type RemoteParentOption struct{}
type RemoteSourceOption ¶ added in v2.1.0
type RemoteSourceOption struct{}
type Servers ¶
type Servers struct {
// contains filtered or unexported fields
}
func NewServers ¶
NewServers will build Spec with a default server and alternative servers.
func (Servers) MarshalYAML ¶
func (*Servers) SetDefault ¶
func (*Servers) UnmarshalYAML ¶
type Spec ¶
type Spec struct {
// contains filtered or unexported fields
}
Spec describes which project is in a root.
func ParseSiblingSpec ¶ added in v2.1.4
ParseSiblingSpec parses string as a repository specification in the same host and same owner.
type SpecParser ¶
type SpecParser struct {
// contains filtered or unexported fields
}
SpecParser will parse any string as a Spec.
If it is clear that the string has host, user and name explicitly, use "NewSpec" instead to build Spec.
func NewSpecParser ¶
func NewSpecParser(servers *Servers) *SpecParser
NewSpecParser will build Spec with a default server and alternative servers.
func (*SpecParser) Parse ¶
func (p *SpecParser) Parse(s string) (Spec, Server, error)
Parse a string and build a Spec.
If the string does not have a host or a user explicitly, they will be replaced with a default server.
func (*SpecParser) ParseWithAlias ¶ added in v2.1.1
ParseWithAlias parses string as a Spec and following alias. We can specify an alias with following '='(equal) and the alias.
If it's not specified, alias will be nil value. If it's specified a value which equals to the spec, alias will be nil value.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
internal
|
|
github_mock
Package github_mock is a generated GoMock package.
|
Package github_mock is a generated GoMock package. |