MCPcopy
hub / github.com/cli/cli / ParseAbsolute

Function ParseAbsolute

internal/safepaths/absolute.go:17–24  ·  view source on GitHub ↗

ParseAbsolute takes a string path that may be relative and returns an Absolute that is guaranteed to be absolute, or an error.

(path string)

Source from the content-addressed store, hash-verified

15// ParseAbsolute takes a string path that may be relative and returns
16// an Absolute that is guaranteed to be absolute, or an error.
17func ParseAbsolute(path string) (Absolute, error) {
18 path, err := filepath.Abs(path)
19 if err != nil {
20 return Absolute{}, fmt.Errorf("failed to get absolute path: %w", err)
21 }
22
23 return Absolute{path: path}, nil
24}
25
26// String returns a string representation of the absolute path, or panics
27// if the absolute path is empty. This guards against programmer error.

Callers 10

extractZipFunction · 0.92
extractTarGzFunction · 0.92
runDownloadFunction · 0.92
Test_DownloadFunction · 0.92
TestParseAbsolutePathFunction · 0.92
mustParseAbsoluteFunction · 0.92
Test_extractZipFunction · 0.92
installLocalSkillFunction · 0.92
installSkillFunction · 0.92
JoinMethod · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by 4

Test_DownloadFunction · 0.74
TestParseAbsolutePathFunction · 0.74
mustParseAbsoluteFunction · 0.74
Test_extractZipFunction · 0.74