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

Function getMinSizeInternal

packages/cli/src/internal/args.ts:597–620  ·  view source on GitHub ↗
(self: Instruction)

Source from the content-addressed store, hash-verified

595}
596
597const getMinSizeInternal = (self: Instruction): number => {
598 switch (self._tag) {
599 case "Empty":
600 case "WithDefault":
601 case "WithFallbackConfig": {
602 return 0
603 }
604 case "Single": {
605 return 1
606 }
607 case "Map": {
608 return getMinSizeInternal(self.args as Instruction)
609 }
610 case "Both": {
611 const leftMinSize = getMinSizeInternal(self.left as Instruction)
612 const rightMinSize = getMinSizeInternal(self.right as Instruction)
613 return leftMinSize + rightMinSize
614 }
615 case "Variadic": {
616 const argsMinSize = getMinSizeInternal(self.args as Instruction)
617 return Math.floor(Option.getOrElse(self.min, () => 0) * argsMinSize)
618 }
619 }
620}
621
622const getMaxSizeInternal = (self: Instruction): number => {
623 switch (self._tag) {

Callers 3

getMinSizeFunction · 0.70
getHelpInternalFunction · 0.70
wizardInternalFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected