MCPcopy Create free account
hub / github.com/exercism/cli / NewExerciseFromDir

Function NewExerciseFromDir

workspace/exercise.go:17–23  ·  view source on GitHub ↗

NewExerciseFromDir constructs an exercise given the exercise directory.

(dir string)

Source from the content-addressed store, hash-verified

15
16// NewExerciseFromDir constructs an exercise given the exercise directory.
17func NewExerciseFromDir(dir string) Exercise {
18 slug := filepath.Base(dir)
19 dir = filepath.Dir(dir)
20 track := filepath.Base(dir)
21 root := filepath.Dir(dir)
22 return Exercise{Root: root, Track: track, Slug: slug}
23}
24
25// Path is the normalized relative path.
26// It always has forward slashes, regardless

Callers 4

TestDownloadFunction · 0.92
exerciseMethod · 0.92
TestNewFromDirFunction · 0.85

Calls

no outgoing calls

Tested by 3

TestDownloadFunction · 0.74
TestNewFromDirFunction · 0.68