Function
decode
(directory: string, filepath: string, content: string)
Source from the content-addressed store, hash-verified
| 68 | } |
| 69 | |
| 70 | function decode(directory: string, filepath: string, content: string) { |
| 71 | const markdown = ConfigMarkdown.parseOption(content) |
| 72 | if (!markdown) return |
| 73 | const info = Option.getOrUndefined(decodeCommand({ ...markdown.data, template: markdown.content.trim() })) |
| 74 | if (!info) return |
| 75 | return { |
| 76 | name: path |
| 77 | .relative(directory, filepath) |
| 78 | .replaceAll("\\", "/") |
| 79 | .replace(/^(command|commands)\//, "") |
| 80 | .replace(/\.md$/, ""), |
| 81 | info, |
| 82 | } |
| 83 | } |
Tested by
no test coverage detected