Skip to content

How to customize prompt symbols? #49

Description

@willowell

Hello,

How do you customize the prompt symbols?

I'm building a little quiz tool for myself where I'd like to check an answer after entering it (i.e., no _.validate or .mapValidated). Something like this:

✔ What is 2 + 2? … 5
× Wrong answer!

...Quiz continues...

✔ What is 1 + 1? … 2
✔ Correct!

The leading symbol on the prompt doesn't make much sense to me in this context; I'd like to leave it as just a question mark instead.

_.validate() and .mapValidated() don't work for me in this case because they halt the quiz on that question.

I saw there is a withTheme() method on class SyncPromptsBuilder and a Symbols trait that I can override but no equivalent withSymbols() method. The .framework() method on the prompts has a symbols: Symbols parameter that looks promising, but it is not available on the short-form prompts, for example:

Prompts.sync.use: prompts =>
  val likeCats = prompts
    .confirm("Do you like cats?") // <- no .framework() method I can chain here
    .toOption

  val name = prompts.run(
    Prompt.Input("What is your name?") // <- but there is a .framework() method I can chain here!
  )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions