MCPcopy Create free account
hub / github.com/Effect-TS/effect / withDescriptionInternal

Function withDescriptionInternal

packages/cli/src/internal/commandDescriptor.ts:832–867  ·  view source on GitHub ↗
(
  self: Instruction,
  description: string | HelpDoc.HelpDoc
)

Source from the content-addressed store, hash-verified

830}
831
832const withDescriptionInternal = (
833 self: Instruction,
834 description: string | HelpDoc.HelpDoc
835): Descriptor.Command<any> => {
836 switch (self._tag) {
837 case "Standard": {
838 const helpDoc = typeof description === "string" ? HelpDoc.p(description) : description
839 const op = Object.create(proto)
840 op._tag = "Standard"
841 op.name = self.name
842 op.description = helpDoc
843 op.options = self.options
844 op.args = self.args
845 return op
846 }
847 case "GetUserInput": {
848 const helpDoc = typeof description === "string" ? HelpDoc.p(description) : description
849 const op = Object.create(proto)
850 op._tag = "GetUserInput"
851 op.name = self.name
852 op.description = helpDoc
853 op.prompt = self.prompt
854 return op
855 }
856 case "Map": {
857 return mapEffect(withDescriptionInternal(self.command, description), self.f)
858 }
859 case "Subcommands": {
860 const op = Object.create(proto)
861 op._tag = "Subcommands"
862 op.parent = withDescriptionInternal(self.parent, description)
863 op.children = self.children.slice()
864 return op
865 }
866 }
867}
868
869const argsWizardHeader = InternalSpan.code("Args Wizard - ")
870const optionsWizardHeader = InternalSpan.code("Options Wizard - ")

Callers 1

Calls 1

createMethod · 0.80

Tested by

no test coverage detected