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

Function handleToggleProcess

packages/effect/src/unstable/cli/Prompt.ts:3845–3872  ·  view source on GitHub ↗
(input: Terminal.UserInput, state: ToggleState)

Source from the content-addressed store, hash-verified

3843}
3844
3845const handleToggleProcess = (input: Terminal.UserInput, state: ToggleState) => {
3846 switch (input.key.name) {
3847 case "0":
3848 case "j":
3849 case "delete":
3850 case "right":
3851 case "down": {
3852 return deactivate
3853 }
3854 case "1":
3855 case "k":
3856 case "left":
3857 case "up": {
3858 return activate
3859 }
3860 case " ":
3861 case "tab": {
3862 return state ? deactivate : activate
3863 }
3864 case "enter":
3865 case "return": {
3866 return Effect.succeed(Action.Submit({ value: state }))
3867 }
3868 default: {
3869 return Effect.succeed(Action.Beep())
3870 }
3871 }
3872}
3873
3874const entriesToDisplay = (cursor: number, total: number, maxVisible?: number) => {
3875 const max = maxVisible === undefined ? total : maxVisible

Callers

nothing calls this directly

Calls 1

succeedMethod · 0.45

Tested by

no test coverage detected