MCPcopy Index your code
hub / github.com/Effect-TS/effect / getMinSizeInternal

Function getMinSizeInternal

packages/cli/src/internal/options.ts:851–881  ·  view source on GitHub ↗
(self: Instruction)

Source from the content-addressed store, hash-verified

849}
850
851const getMinSizeInternal = (self: Instruction): number => {
852 switch (self._tag) {
853 case "Empty":
854 case "WithDefault":
855 case "WithFallback": {
856 return 0
857 }
858 case "Single":
859 case "KeyValueMap": {
860 return 1
861 }
862 case "Map": {
863 return getMinSizeInternal(self.options as Instruction)
864 }
865 case "Both": {
866 const leftMinSize = getMinSizeInternal(self.left as Instruction)
867 const rightMinSize = getMinSizeInternal(self.right as Instruction)
868 return leftMinSize + rightMinSize
869 }
870 case "OrElse": {
871 const leftMinSize = getMinSizeInternal(self.left as Instruction)
872 const rightMinSize = getMinSizeInternal(self.right as Instruction)
873 return Math.min(leftMinSize, rightMinSize)
874 }
875 case "Variadic": {
876 const selfMinSize = Option.getOrElse(self.min, () => 0)
877 const argumentOptionMinSize = getMinSizeInternal(self.argumentOption as Instruction)
878 return selfMinSize * argumentOptionMinSize
879 }
880 }
881}
882
883const getMaxSizeInternal = (self: Instruction): number => {
884 switch (self._tag) {

Callers 3

getMinSizeFunction · 0.70
getHelpInternalFunction · 0.70
wizardInternalFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected