click icon indicating copy to clipboard operation
click copied to clipboard

Add format customization flow to `click.prompt` and `click.confirm` via `PromptBuilder` class

Open AdamPiotrowski91 opened this issue 8 months ago • 1 comments

This PR implements a base class which allows to customize prompt format when used directly via click.prompt or click.confirm methods.

It adds an optional parameter which can be an instance of a PromptBuilder class or one inheriting from it.

You can customize all of the below in any combination:

  • how the prompt is built via overriding build method
  • how the choices are shown via overriding add_choices method
  • how the default is shown via overriding add_default method
  • how to calculate if choices should be shown via overriding should_add_choices method
  • how to calculate if default should be shown via overriding should_add_default method

fixes #2875

AdamPiotrowski91 avatar Apr 08 '25 07:04 AdamPiotrowski91

Tests pass, but I am not sure, based on the logs, why do the other jobs fail. Would appreciate some help in this regard.

AdamPiotrowski91 avatar Apr 08 '25 07:04 AdamPiotrowski91