MCPcopy Create free account
hub / github.com/compozy/agh / commandSegments

Function commandSegments

internal/cli/docpost/docpost.go:236–250  ·  view source on GitHub ↗
(fileName string, base string)

Source from the content-addressed store, hash-verified

234}
235
236func commandSegments(fileName string, base string) ([]string, error) {
237 if base == docpostAghKey {
238 return nil, nil
239 }
240 if !strings.HasPrefix(base, "agh_") {
241 return nil, fmt.Errorf("docpost: unexpected filename %q (must be 'agh.md' or start with 'agh_')", fileName)
242 }
243 segments := strings.Split(base, "_")[1:]
244 for _, segment := range segments {
245 if !segmentRe.MatchString(segment) {
246 return nil, fmt.Errorf("docpost: unexpected filename %q (invalid command segment %q)", fileName, segment)
247 }
248 }
249 return segments, nil
250}
251
252// computeHasChildren marks a baseName as a "parent" when any other input's
253// baseName starts with baseName + "_". Parents render as index.mdx in their

Callers 2

readInputFunction · 0.85

Calls

no outgoing calls

Tested by 1