From c6272ac218bc07b3133c3a3c73d74805e41270c5 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 28 Nov 2023 15:45:21 +1300 Subject: [PATCH] update prompt example --- examples/prompt.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/examples/prompt.ts b/examples/prompt.ts index 4f2e450..ddb62d7 100644 --- a/examples/prompt.ts +++ b/examples/prompt.ts @@ -1,5 +1,4 @@ -import * as CliApp from "@effect/cli/CliApp" -import * as Command from "@effect/cli/CommandDescriptor" +import * as Command from "@effect/cli/Command" import * as Prompt from "@effect/cli/Prompt" import * as NodeContext from "@effect/platform-node/NodeContext" import * as Runtime from "@effect/platform-node/Runtime" @@ -57,14 +56,12 @@ const prompt = Prompt.all([ togglePrompt ]) -const cli = CliApp.make({ +const cli = Command.run(Command.prompt("favorites", prompt, Effect.log), { name: "Prompt Examples", - version: "0.0.1", - command: Command.prompt("favorites", prompt) + version: "0.0.1" }) -Effect.sync(() => process.argv.slice(2)).pipe( - Effect.flatMap((args) => CliApp.run(cli, args, (input) => Effect.log(input))), +Effect.suspend(() => cli(process.argv.slice(2))).pipe( Effect.provide(NodeContext.layer), Runtime.runMain )