MCPcopy Create free account
hub / github.com/cremich/promptz / parseSubmoduleBlock

Function parseSubmoduleBlock

lib/libraries.ts:72–94  ·  view source on GitHub ↗

* Parse a single submodule block

(block: string)

Source from the content-addressed store, hash-verified

70 * Parse a single submodule block
71 */
72function parseSubmoduleBlock(block: string): { name: string; url: string; path: string } | null {
73 const lines = block.split('\n').map(line => line.trim()).filter(line => line)
74 let name = ''
75 let path = ''
76 let url = ''
77
78 for (const line of lines) {
79 if (line.startsWith('"') && line.endsWith('"]')) {
80 name = line.slice(1, -2)
81 } else if (line.startsWith('path = ')) {
82 path = line.replace('path = ', '')
83 } else if (line.startsWith('url = ')) {
84 url = line.replace('url = ', '')
85 }
86 }
87
88 if (name && path && url) {
89 const libraryName = path.split('/').pop() || name
90 return { name: libraryName, url, path }
91 }
92
93 return null
94}
95
96/**
97 * Read README content for a library

Callers 1

parseGitmodulesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected