( path: Option.Option<string>, options: FileOptions )
| 38 | const renderBeep = Doc.render(Doc.beep, { style: "pretty" }) |
| 39 | |
| 40 | function 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 | |
| 63 | function getFileList(directory: string, options: FileOptions) { |
| 64 | return Effect.gen(function*() { |
no test coverage detected