MCPcopy Create free account
hub / github.com/effect-app/libs / integer

Function integer

repos/effect/packages/effect/src/unstable/cli/Prompt.ts:991–1020  ·  view source on GitHub ↗
(options: IntegerOptions)

Source from the content-addressed store, hash-verified

989 never,
990 Environment
991 > = Effect.gen(function*() {
992 const currentPath = yield* resolveCurrentPath(Option.none(), opts)
993 const path = yield* Path.Path
994 const defaultPath = Option.map(opts.default, (defaultValue) => path.resolve(currentPath, defaultValue))
995 const initialPath = Option.match(defaultPath, {
996 onNone: () => currentPath,
997 onSome: (defaultPath) => path.dirname(defaultPath)
998 })
999 const files = yield* getFileList(initialPath, opts)
1000 const cursor = Option.match(defaultPath, {
1001 onNone: () => 0,
1002 onSome: (defaultPath) => {
1003 const index = files.indexOf(path.basename(defaultPath))
1004 return index === -1 ? 0 : index
1005 }
1006 })
1007 const confirm = FileConfirm.Hide()
1008 return { cursor, files, allFiles: files, query: "", path: Option.map(defaultPath, path.dirname), confirm }
1009 })
1010 return Custom(initialState, {
1011 render: handleFileRender(opts),
1012 process: handleFileProcess(opts),
1013 clear: handleFileClear(opts)
1014 })
1015}
1016
1017/**
1018 * Composes prompts by using the output of this prompt to create the next prompt.
1019 *
1020 * @category combinators
1021 * @since 4.0.0
1022 */
1023export const flatMap: {

Callers

nothing calls this directly

Calls 6

handleRenderIntegerFunction · 0.85
handleProcessIntegerFunction · 0.85
handleNumberClearFunction · 0.85
customFunction · 0.70
failMethod · 0.45
succeedMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…