Documentation ¶
Index ¶
- func IsNotExist(err error) bool
- func IsNotInWorkspace(err error) bool
- func IsSolutionPath(solutionID, path string) (bool, error)
- type ErrNotExist
- type ErrNotInWorkspace
- type PathType
- type Solution
- type Solutions
- type Transmission
- type Workspace
- func (ws Workspace) Locate(exercise string) ([]string, error)
- func (ws Workspace) ResolveSolutionPath(paths []string, exercise, solutionID string, ...) (string, error)
- func (ws Workspace) SolutionDir(s string) (string, error)
- func (ws Workspace) SolutionPath(exercise, solutionID string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNotExist ¶
IsNotExist checks if this is an ErrNotExist error.
func IsNotInWorkspace ¶
IsNotInWorkspace checks if this is an ErrNotInWorkspace error.
func IsSolutionPath ¶
IsSolutionPath checks whether the given path contains the solution with the given ID.
Types ¶
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 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"` URL string `json:"url"` Handle string `json:"handle"` IsRequester bool `json:"is_requester"` SubmittedAt *time.Time `json:"submitted_at,omitempty"` Dir string `json:"-"` }
Solution contains metadata about a user's solution.
func NewSolution ¶
NewSolution reads solution metadata from a file in the given directory.
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.
func (Solutions) Display ¶
Display shows a numbered list of the solutions to choose from. The list starts at 1, since that seems better in a user interface.
func (Solutions) Get ¶
Get returns the solution corresponding to the number. The list starts at 1, since that seems better in a user interface.
type Transmission ¶
Transmission as the data necessary to submit a solution.
func NewTransmission ¶
func NewTransmission(root string, args []string) (*Transmission, error)
NewTransmission processes the arguments to the submit command to prep a submission.
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) Locate ¶
Locate the matching directories within the workspace. This will look for an exact match on absolute or relative paths. If given the base name of a directory with no path information it It will look for all directories with that name, or that are named with a numerical suffix.
func (Workspace) ResolveSolutionPath ¶
func (ws Workspace) ResolveSolutionPath(paths []string, exercise, solutionID string, existsFn func(string, string) (bool, error)) (string, error)
ResolveSolutionPath determines the path for the given exercise solution. It will locate an existing path, or indicate the name of a new path, if this is a new solution.
func (Workspace) SolutionDir ¶
SolutionDir determines the root directory of a solution. This is the directory that contains the solution metadata file.
func (Workspace) SolutionPath ¶
SolutionPath returns the full path where the exercise will be stored. By default this the directory name matches that of the exercise, but if a different solution already exists, then a numeric suffix will be added to the name.