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

Function getMinSizeInternal

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

Source from the content-addressed store, hash-verified

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

Callers 3

getMinSizeFunction · 0.70
getHelpInternalFunction · 0.70
wizardInternalFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected