Skip to content

new: better prompt with help and validation regexp. #381

@vaab

Description

@vaab

Couldn't push as a PR as it's based on another PR #380

But here is the code: https://github.com/0k/cookiecutter/commits/pr-better-prompt

It uses the context argument and interpret help, default,
regex attributes.

Example::

context:
  name:
    help: "Module name (ie: sale_trinkets)"
    regex: '[a-zA-Z0-9_]+'
  website:
    help: "Website (ie: http://www.yourwebsite.com)"
    default:
    regex: '[^ ]+'

Optional values and the ones having an empty default value.
A value without default value is considered required.

If the context meta information dict is detected, it'll trigger the behavior.

There are missing tests for now, but I just wanted first to feel the heat for such PR before spending too much time on it.

It passes all normal tests and so proves that nothing tested was broken.

I guess this could be 2cents for the discussions at #30, #360, #169...

Ho, and this is a full template repo that I use with this:

https://github.com/0k/cookiecutter-odoo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions