repository

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2014 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package repository implements detection, filtering and structure of repositories. This source defines various interfaces.

Package repository implements detection, filtering and structure of repositories. This source detects and filters repositories.

Package repository implements detection, filtering and structure of repositories. This source structures a single repository for processing by others.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindRepositories

func FindRepositories(filter RepositoryFilter, numDigesters int) chan Repository

findRepositories finds and filters repositories below the rootDirectory.

Types

type ByIndex

type ByIndex []Repository

func (ByIndex) Len

func (a ByIndex) Len() int

func (ByIndex) Less

func (a ByIndex) Less(i, j int) bool

func (ByIndex) Swap

func (a ByIndex) Swap(i, j int)

type Command

type Command interface {
	Usage() string // short string describing the usage
	Help() string  // help info

	Init(args []string, interactive bool) Command
}

Command is shared interface used for each command.

type Filter

type Filter interface {
	// Return true if the repository should be included.
	FilterRepository(Repository) bool
}

Filter is the actual interface of a repository filter.

type FilterDefinition

type FilterDefinition interface {
	Name() string // name of the filter

	Usage() map[string]string // usage for each flag

	// Add flags for the command-line parser.
	AddFlags(*flag.FlagSet) Filter
}

FilterDefinition is the interface used for each filter definition.

type InfoCommand

type InfoCommand interface {
	Output(map[string]Command, string) string // commands and version string
}

InfoCommand is a special command that shows internal info.

type LineOutputCommand

type LineOutputCommand interface {
	Header() string
	Footer() string

	Output(Repository) string
}

LineOutputCommand is a command which outputs lines.

type Repository

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

func NewRepository

func NewRepository(index int, name, gitpath string) (repository Repository, ok bool)

NewRepository returns a Repository structure describing the repository. If there is an error, ok will be false.

func (Repository) ExecGit

func (repository Repository) ExecGit(args ...string) (result string, err error, ok bool)

func (Repository) ExecGitInteractive

func (repository Repository) ExecGitInteractive(args ...string) (ok bool)

func (*Repository) GetConfig

func (repository *Repository) GetConfig() go_ini.File

func (*Repository) GetCurrentBranch

func (repository *Repository) GetCurrentBranch() string

GetCurrentBranch returns the current branch.

func (*Repository) GetGitRoot

func (repository *Repository) GetGitRoot() string

GetGitRoot returns repository .git root directory.

func (*Repository) GetInfo

func (repository *Repository) GetInfo(name string) interface{}

GetInfo retrieves information a command wants to publish.

func (*Repository) GetPath

func (repository *Repository) GetPath() string

GetPath returns repository root directory.

func (*Repository) GetShowName

func (repository *Repository) GetShowName() string

GetName returns repository name.

func (*Repository) GetStatusJudgement

func (repository *Repository) GetStatusJudgement() string

GetStatusJudgement judges the current status. Basically just shows if we have staged, unstaged or untracked files.

func (*Repository) NameContains

func (repository *Repository) NameContains(search string) bool

NameContains returns true if name contains search.

func (*Repository) PutInfo

func (repository *Repository) PutInfo(name string, value interface{})

PutInfo stores information a command wants to publish later.

func (Repository) ReplaceMacros

func (repository Repository) ReplaceMacros(args []string) (out []string)

ReplaceMacros replaces macros from the arguments and returns the strings with replacements.

func (*Repository) RetrieveBasics

func (repository *Repository) RetrieveBasics()

retrieveBasics retrieves the current branch, status.

type RepositoryCommand

type RepositoryCommand interface {
	IsInteractive() bool // Return true if command can be interactive.

	// Run the actual command.
	Run(Repository) (Repository, bool)
}

RepositoryCommand is the interface used commands that act on repositories.

type RepositoryFilter

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

RepositoryFilter defines a filter for repositories.

func NewRepositoryFilter

func NewRepositoryFilter(rootDirectory string, depth int, filters []Filter) (filter RepositoryFilter)

create a new RepositoryFilter

type RowOutputCommand

type RowOutputCommand interface {
	Header() []string // Column headers.

	Output(Repository) interface{} // [][]string, []string or string
}

RowOutputCommand is a command which outputs rows.

Jump to

Keyboard shortcuts

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