Skip to content

Method used to build prompts under the hood does not allow for full format customization #2875

@AdamPiotrowski91

Description

@AdamPiotrowski91

Currently method _build_prompt is implemented in very opinionated way regarding formatting how to display choices or default value. Considering how good of a job the rest of the features do in regards to potential extensions and customizations, I am surprised that the best way I found to customize this method is to overwrite it before use, for example as follows:

import click

def my_own_build_prompts(*args, **kwargs):
    pass

click.termui._build_prompt = my_own_build_prompts

Even though it is "technically" possible to override, I'd argue the fact that in order to find it I had to dig deep into codebase and find the details of implementation feels "hacky" and "not intended" - and for sure error prone and not future-proof.

I am very happy to contribute and implement the solution, but I'd rather hear some opinions from the library owners beforehand whether this is something they'd find valuable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    TBDNot enough information to proceed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions