Documentation ¶
Index ¶
- func FormatLog(f logrus.Formatter)
- func VerboseLog()
- type Corpus
- func (c *Corpus) ForEachRepo(fn func(repo WatchedRepository) error) error
- func (c *Corpus) ForEachRepoF(fn func(repo WatchedRepository) error, ...) error
- func (c *Corpus) Initialize(ctx context.Context) error
- func (c *Corpus) RLock()
- func (c *Corpus) RUnlock()
- func (c *Corpus) SetDebug()
- func (c *Corpus) SetVerbose(v bool)
- func (c *Corpus) Sync(ctx context.Context) error
- func (c *Corpus) TrackGit(url string, branch string) error
- type File
- type GitCommit
- type SampleMeta
- type SampleMetadata
- type Snippet
- type SnippetMetaRef
- type SnippetVersion
- type SnippetVersionMeta
- type WatchedRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Corpus ¶
type Corpus struct {
// contains filtered or unexported fields
}
Corpus holds all of a project's metadata.
func (*Corpus) ForEachRepo ¶
func (c *Corpus) ForEachRepo(fn func(repo WatchedRepository) error) error
ForEachRepo iterates over the set of repositories and performs the given function on each and returns the first non-nill error it recieves.
func (*Corpus) ForEachRepoF ¶
func (c *Corpus) ForEachRepoF(fn func(repo WatchedRepository) error, filter func(repo WatchedRepository) bool) error
ForEachRepoF iterates over the set of repositories that match the given filter and performs the given function on them, and returns the first non-nill error it recieves.
func (*Corpus) Initialize ¶
Initialize should be the first call to the corpus to do the initial clone and synchronizing of the corpus's repository set.
func (*Corpus) RLock ¶
func (c *Corpus) RLock()
RLock grabs the corpus's read lock. Grabbing the read lock prevents any concurrent writes from mutating the corpus. This is only necessary if the application is querying the corpus and calling its Update method concurrently.
func (*Corpus) SetDebug ¶
func (c *Corpus) SetDebug()
SetDebug instructs the Corpus to run in debug mode
func (*Corpus) SetVerbose ¶
SetVerbose enables or disables verbose logging.
type GitCommit ¶
type GitCommit struct { Body string Subject string AuthorEmail string AuthoredTime time.Time CommitterEmail string CommittedTime time.Time Hash string Name string }
GitCommit represents a commit in git
type SampleMeta ¶
type SampleMeta struct { Title string `yaml:"title"` Description string `yaml:"description"` Usage string `yaml:"usage"` APIVersion string `yaml:"api_version"` Snippets []SnippetMetaRef `yaml:"snippets"` }
SampleMeta stores structured metadata about a singular Sample. It can have several Snippets associated with it.
type SampleMetadata ¶
type SampleMetadata struct {
Meta SampleMeta `yaml:"sample-metadata"`
}
SampleMetadata is the root note of a SampleMeta
type Snippet ¶
type Snippet struct { Name string Language string Versions []SnippetVersion Primary SnippetVersion }
Snippet represents a snippet of code
func CalculateSnippets ¶
func CalculateSnippets(o, r string, iter git.CommitIter) ([]*Snippet, error)
CalculateSnippets scans the given set of commits and extracts the snippets found in them
type SnippetMetaRef ¶
type SnippetMetaRef struct { RegionTag string `yaml:"region_tag"` Description string `yaml:"description"` Usage string `yaml:"usage"` }
SnippetMetaRef stores strucutred data about a single Snippet
type SnippetVersion ¶
type SnippetVersion struct { Name string File *File Lines []string Content string Meta SnippetVersionMeta }
SnippetVersion represents a snippet at a particular commit in a repository
type SnippetVersionMeta ¶
SnippetVersionMeta stores metadata about a particular SnippetVersion
type WatchedRepository ¶
type WatchedRepository interface { // Unique Identifier of the Repository // TODO(colnnelson): Work out the details of this ID() string // Allows iterating over a WatchedRepository's snippets ForEachSnippet(func(snippet *Snippet) error) error // Allows iterating over a WatchedRepository's snippets that match the given filter ForEachSnippetF(func(snippet *Snippet) error, func(snippet *Snippet) bool) error // Allows iterating over a WatchedRepository's git commits ForEachGitCommit(func(commit *GitCommit) error) error // Allows iterating over a WatchedRepository's git commits that match the given filter ForEachGitCommitF(func(commit *GitCommit) error, func(commit *GitCommit) bool) error // The owner of the repository Owner() string // The name of the repository RepositoryName() string // Instructs the Repository to Update Update(ctx context.Context) error }
WatchedRepository represents a repository being watched by the Corpus
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd/completion
Package completion provides shell completion capabilities for the CLI.
|
Package completion provides shell completion capabilities for the CLI. |
testutil
Package testutil contains helpers for working with commands in tests.
|
Package testutil contains helpers for working with commands in tests. |