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

Function getMaxSizeInternal

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

Source from the content-addressed store, hash-verified

881}
882
883const getMaxSizeInternal = (self: Instruction): number => {
884 switch (self._tag) {
885 case "Empty": {
886 return 0
887 }
888 case "Single": {
889 return 1
890 }
891 case "KeyValueMap": {
892 return Number.MAX_SAFE_INTEGER
893 }
894 case "Map":
895 case "WithDefault":
896 case "WithFallback": {
897 return getMaxSizeInternal(self.options as Instruction)
898 }
899 case "Both": {
900 const leftMaxSize = getMaxSizeInternal(self.left as Instruction)
901 const rightMaxSize = getMaxSizeInternal(self.right as Instruction)
902 return leftMaxSize + rightMaxSize
903 }
904 case "OrElse": {
905 const leftMin = getMaxSizeInternal(self.left as Instruction)
906 const rightMin = getMaxSizeInternal(self.right as Instruction)
907 return Math.min(leftMin, rightMin)
908 }
909 case "Variadic": {
910 const selfMaxSize = Option.getOrElse(self.max, () => Number.MAX_SAFE_INTEGER / 2)
911 const optionsMaxSize = getMaxSizeInternal(self.argumentOption as Instruction)
912 return Math.floor(selfMaxSize * optionsMaxSize)
913 }
914 }
915}
916
917const getUsageInternal = (self: Instruction): Usage.Usage => {
918 switch (self._tag) {

Callers 3

getMaxSizeFunction · 0.70
getHelpInternalFunction · 0.70
wizardInternalFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected