Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsMissingMetadata ¶
IsMissingMetadata verifies the type of error.
func IsNotExist ¶
IsNotExist checks if this is an ErrNotExist error.
func IsNotInWorkspace ¶
IsNotInWorkspace checks if this is an ErrNotInWorkspace error.
Types ¶
type Document ¶
Document is a file in a directory.
func NewDocument ¶
NewDocument creates a document from the filepath. The root is typically the root of the exercise, and path is the absolute path to the file.
type ErrNotExist ¶
type ErrNotExist string
ErrNotExist signals that the target directory could not be located.
func (ErrNotExist) Error ¶
func (err ErrNotExist) Error() string
type ErrNotInWorkspace ¶
type ErrNotInWorkspace string
ErrNotInWorkspace signals that the target directory is outside the configured workspace.
func (ErrNotInWorkspace) Error ¶
func (err ErrNotInWorkspace) Error() string
type Exercise ¶
Exercise is an implementation of a problem in a track.
func NewExerciseFromDir ¶
NewExerciseFromDir constructs an exercise given the exercise directory.
func (Exercise) HasMetadata ¶
HasMetadata checks for the presence of an exercise metadata file. If there is no such file, this may be a legacy exercise. It could also be an unrelated directory.
func (Exercise) MetadataDir ¶
MetadataDir returns the directory that the exercise metadata lives in. For now this is the exercise directory.
func (Exercise) MetadataFilepath ¶
MetadataFilepath is the absolute path to the exercise metadata.
type PathType ¶
type PathType int
PathType is either a path to a dir or file, or the name of an exercise.
func DetectPathType ¶
DetectPathType determines whether the given path is a directory, a file, or the name of an exercise.
type Solution ¶
type Solution struct { Track string `json:"track"` Exercise string `json:"exercise"` ID string `json:"id"` Team string `json:"team,omitempty"` URL string `json:"url"` Handle string `json:"handle"` IsRequester bool `json:"is_requester"` SubmittedAt *time.Time `json:"submitted_at,omitempty"` Dir string `json:"-"` AutoApprove bool `json:"auto_approve"` }
Solution contains metadata about a user's solution.
func NewSolution ¶
NewSolution reads solution metadata from a file in the given directory.
func (*Solution) PathToParent ¶
PathToParent is the relative path from the workspace to the parent dir.
type Solutions ¶
type Solutions []*Solution
Solutions is a collection of solutions to interactively choose from.
func NewSolutions ¶
NewSolutions loads up the solution metadata for each of the provided paths.
type Workspace ¶
type Workspace struct {
Dir string
}
Workspace represents a user's Exercism workspace. It may contain a user's own exercises, and other people's exercises that they've downloaded to look at or run locally.
func (Workspace) Exercises ¶
Exercises returns the user's exercises within the workspace. This doesn't find legacy exercises where the metadata is missing.
func (Workspace) PotentialExercises ¶
PotentialExercises are a first-level guess at the user's exercises. It looks at the workspace structurally, and guesses based on the location of the directory. E.g. any top level directory within the workspace (except 'users') is assumed to be a track, and any directory within there again is assumed to be an exercise.