MCPcopy
hub / github.com/Effect-TS/effect / getHelpInternal

Function getHelpInternal

packages/cli/src/internal/primitive.ts:293–357  ·  view source on GitHub ↗
(self: Instruction)

Source from the content-addressed store, hash-verified

291}
292
293const getHelpInternal = (self: Instruction): Span.Span => {
294 switch (self._tag) {
295 case "Bool": {
296 return InternalSpan.text("A true or false value.")
297 }
298 case "Choice": {
299 const choices = pipe(
300 Arr.map(self.alternatives, ([choice]) => choice),
301 Arr.join(", ")
302 )
303 return InternalSpan.text(`One of the following: ${choices}`)
304 }
305 case "DateTime": {
306 return InternalSpan.text(
307 "A date without a time-zone in the ISO-8601 format, such as 2007-12-03T10:15:30."
308 )
309 }
310 case "Float": {
311 return InternalSpan.text("A floating point number.")
312 }
313 case "Integer": {
314 return InternalSpan.text("An integer.")
315 }
316 case "Path": {
317 if (self.pathType === "either" && self.pathExists === "yes") {
318 return InternalSpan.text("An existing file or directory.")
319 }
320 if (self.pathType === "file" && self.pathExists === "yes") {
321 return InternalSpan.text("An existing file.")
322 }
323 if (self.pathType === "directory" && self.pathExists === "yes") {
324 return InternalSpan.text("An existing directory.")
325 }
326 if (self.pathType === "either" && self.pathExists === "no") {
327 return InternalSpan.text("A file or directory that must not exist.")
328 }
329 if (self.pathType === "file" && self.pathExists === "no") {
330 return InternalSpan.text("A file that must not exist.")
331 }
332 if (self.pathType === "directory" && self.pathExists === "no") {
333 return InternalSpan.text("A directory that must not exist.")
334 }
335 if (self.pathType === "either" && self.pathExists === "either") {
336 return InternalSpan.text("A file or directory.")
337 }
338 if (self.pathType === "file" && self.pathExists === "either") {
339 return InternalSpan.text("A file.")
340 }
341 if (self.pathType === "directory" && self.pathExists === "either") {
342 return InternalSpan.text("A directory.")
343 }
344 throw new Error(
345 "[BUG]: Path.help - encountered invalid combination of path type " +
346 `('${self.pathType}') and path existence ('${self.pathExists}')`
347 )
348 }
349 case "Secret":
350 case "Redacted": {

Callers 1

getHelpFunction · 0.70

Calls 4

pipeFunction · 0.70
mapMethod · 0.65
joinMethod · 0.65
textMethod · 0.45

Tested by

no test coverage detected