Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Effect CLI Select #53

Open
youngkyo0504 opened this issue Jul 21, 2024 · 0 comments
Open

Effect CLI Select #53

youngkyo0504 opened this issue Jul 21, 2024 · 0 comments

Comments

@youngkyo0504
Copy link
Owner


title:
full_path: src/pages/.md

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/NodeRuntime"
import * as Effect from "effect/Effect"

const promptColor = Prompt.select({
  message: "Pick your favorite color",
  choices: [
    { title: "Red", value: "red", description: "This option has a description" },
    { title: "Green", value: "green", description: "So does this one" },
    { title: "Blue", value: "blue"}
  ]
});

const command = Command.prompt("favorites", promptColor, (color)=>{
    return Effect.gen(function* (_) {
        const name = yield* _(Prompt.text({ message: "What is your name?" }))
        const df = yield* _(Prompt.text({ message: "What is your name?" }))
  
        const s = yield* _(Prompt.select({
      message: "Pick your favorite color",
      choices: [
        { title: "Red", value: "red", description: "This option has a description" },
        { title: "Green", value: "green", description: "So does this one" },
        { title: "Blue", value: "blue"}
      ]
    })
        )
      })
});

const cli = Command.run(command, {
  name: "Prompt Examples",
  version: "0.0.1"
});

Effect.suspend(() => cli(process.argv)).pipe(
    Effect.provide(NodeContext.layer),
    Runtime.runMain,
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant