MCPcopy Create free account
hub / github.com/github/gh-aw / parseMountEntry

Function parseMountEntry

pkg/workflow/validation_helpers.go:131–146  ·  view source on GitHub ↗

parseMountEntry parses a mount string and classifies the validation result. It returns the parsed parts together with a mountValidationKind so callers can map the shared result to their own error constructors. On format errors the returned parts are empty; on mode and empty-path errors any successfu

(mount string)

Source from the content-addressed store, hash-verified

129// returned parts are empty; on mode and empty-path errors any successfully parsed
130// fields are preserved in mountParts.
131func parseMountEntry(mount string) (mountParts, mountValidationKind) {
132 source, dest, mode, err := validateMountStringFormat(mount)
133 if err != nil {
134 if source == "" && dest == "" && mode == "" {
135 return mountParts{}, mountValidationFormatError
136 }
137 return mountParts{source: source, dest: dest, mode: mode}, mountValidationModeError
138 }
139 if source == "" {
140 return mountParts{source: source, dest: dest, mode: mode}, mountValidationEmptySource
141 }
142 if dest == "" {
143 return mountParts{source: source, dest: dest, mode: mode}, mountValidationEmptyDestination
144 }
145 return mountParts{source: source, dest: dest, mode: mode}, mountValidationOK
146}
147
148// validateMountEntries applies shared mount parsing and classification across
149// callers while allowing each caller to preserve its own logging and error

Callers 2

validateMountEntriesFunction · 0.85
TestParseMountEntryFunction · 0.85

Calls 1

Tested by 1

TestParseMountEntryFunction · 0.68