diff options
| author | Elizabeth Hunt <elizabeth@simponic.xyz> | 2024-08-01 09:15:33 -0700 |
|---|---|---|
| committer | Elizabeth Hunt <elizabeth@simponic.xyz> | 2024-08-01 09:15:33 -0700 |
| commit | 5dbd16878546886cae5b56b67de6185bfbae0d07 (patch) | |
| tree | 8dd29c83d8f56b254d964ec040be9bcea0bc108b /src/index.ts | |
| parent | ad74ff999589e0df2b60ba6e94362ed5215af312 (diff) | |
| download | mon.hatecomputers.club-5dbd16878546886cae5b56b67de6185bfbae0d07.tar.gz mon.hatecomputers.club-5dbd16878546886cae5b56b67de6185bfbae0d07.zip | |
add arg parser
Diffstat (limited to 'src/index.ts')
| -rw-r--r-- | src/index.ts | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/index.ts b/src/index.ts index 95fd41f..2b3e95e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,16 @@ -import * as IO from "fp-ts/IO"; -import { readFileSync } from "fs"; - -const main: IO.IO<void> = ConsoleLogger.log("Hello, world!"); +import * as TE from "fp-ts/lib/TaskEither"; +import { pipe } from "fp-ts/lib/function"; +import { toError } from "fp-ts/lib/Either"; +import { readConfig } from "./config"; +import { parseArgs } from "./args"; +const main: TE.TaskEither<Error, void> = pipe( + TE.fromEither(parseArgs(Bun.argv)), + TE.bindTo("args"), + TE.bind("config", ({ args }) => TE.fromIO(readConfig(args.testsFile))), + TE.fold( + (e) => TE.left(toError(e)), + () => TE.right(undefined), + ), +); main(); |
