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

Function resolveCurrentPath

packages/cli/src/internal/prompt/file.ts:40–61  ·  view source on GitHub ↗
(
  path: Option.Option<string>,
  options: FileOptions
)

Source from the content-addressed store, hash-verified

38const renderBeep = Doc.render(Doc.beep, { style: "pretty" })
39
40function resolveCurrentPath(
41 path: Option.Option<string>,
42 options: FileOptions
43): Effect.Effect<string, never, FileSystem.FileSystem> {
44 return Option.match(path, {
45 onNone: () =>
46 Option.match(options.startingPath, {
47 onNone: () => Effect.sync(() => process.cwd()),
48 onSome: (path) =>
49 Effect.flatMap(FileSystem.FileSystem, (fs) =>
50 // Ensure the user provided starting path exists
51 Effect.orDie(fs.exists(path)).pipe(
52 Effect.filterOrDieMessage(
53 identity,
54 `The provided starting path '${path}' does not exist`
55 ),
56 Effect.as(path)
57 ))
58 }),
59 onSome: (path) => Effect.succeed(path)
60 })
61}
62
63function getFileList(directory: string, options: FileOptions) {
64 return Effect.gen(function*() {

Callers 5

handleClearFunction · 0.85
renderNextFrameFunction · 0.85
processSelectionFunction · 0.85
handleProcessFunction · 0.85
fileFunction · 0.85

Calls 2

syncMethod · 0.80
pipeMethod · 0.65

Tested by

no test coverage detected