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

Function NewDocument

workspace/document.go:14–23  ·  view source on GitHub ↗

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.

(root, path string)

Source from the content-addressed store, hash-verified

12// The root is typically the root of the exercise, and
13// path is the absolute path to the file.
14func NewDocument(root, path string) (Document, error) {
15 path, err := filepath.Rel(root, path)
16 if err != nil {
17 return Document{}, err
18 }
19 return Document{
20 Root: root,
21 RelativePath: path,
22 }, nil
23}
24
25// Filepath is the absolute path to the document on the filesystem.
26func (doc Document) Filepath() string {

Callers 2

documentsMethod · 0.92

Calls

no outgoing calls

Tested by 1