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

Function resolveCurrentPath

packages/effect/src/cli/Prompt.ts:2278–2299  ·  view source on GitHub ↗
(
  path: Option.Option<string>,
  options: FileOptionsReq
)

Source from the content-addressed store, hash-verified

2276const showConfirmation = FileConfirm.$is("Show")
2277
2278const resolveCurrentPath = (
2279 path: Option.Option<string>,
2280 options: FileOptionsReq
2281): Effect.Effect<string, never, FileSystem.FileSystem> => {
2282 if (Option.isSome(path)) {
2283 return Effect.succeed(path.value)
2284 }
2285 if (Option.isSome(options.startingPath)) {
2286 const startingPath = options.startingPath.value
2287 return Effect.flatMap(FileSystem.FileSystem, (fs) =>
2288 // Ensure the user provided starting path exists
2289 Effect.orDie(fs.exists(startingPath)).pipe(
2290 Effect.flatMap((exists) =>
2291 exists ? Effect.void : Effect.die(
2292 `The provided starting path '${startingPath}' does not exist`
2293 )
2294 ),
2295 Effect.as(startingPath)
2296 ))
2297 }
2298 return Effect.sync(() => process.cwd())
2299}
2300
2301const getFileList = Effect.fnUntraced(function*(directory: string, options: FileOptionsReq) {
2302 const fs = yield* FileSystem.FileSystem

Callers 4

FileFunction · 0.85
handleFileClearFunction · 0.85
Prompt.tsFile · 0.85
handleFileProcessFunction · 0.85

Calls 3

pipeMethod · 0.65
succeedMethod · 0.45
syncMethod · 0.45

Tested by

no test coverage detected