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

Function getMaxSizeInternal

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

Source from the content-addressed store, hash-verified

620}
621
622const getMaxSizeInternal = (self: Instruction): number => {
623 switch (self._tag) {
624 case "Empty": {
625 return 0
626 }
627 case "Single": {
628 return 1
629 }
630 case "Map":
631 case "WithDefault":
632 case "WithFallbackConfig": {
633 return getMaxSizeInternal(self.args as Instruction)
634 }
635 case "Both": {
636 const leftMaxSize = getMaxSizeInternal(self.left as Instruction)
637 const rightMaxSize = getMaxSizeInternal(self.right as Instruction)
638 return leftMaxSize + rightMaxSize
639 }
640 case "Variadic": {
641 const argsMaxSize = getMaxSizeInternal(self.args as Instruction)
642 return Math.floor(Option.getOrElse(self.max, () => Number.MAX_SAFE_INTEGER / 2) * argsMaxSize)
643 }
644 }
645}
646
647const getUsageInternal = (self: Instruction): Usage.Usage => {
648 switch (self._tag) {

Callers 3

getMaxSizeFunction · 0.70
getHelpInternalFunction · 0.70
wizardInternalFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected