From bdb4cdde9451afd353a4cb439ce57db55770cf79 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Fri, 12 Jul 2024 20:13:22 +0200 Subject: [PATCH 1/2] Validate input --- copier.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/copier.yml b/copier.yml index 2401b65..206f078 100644 --- a/copier.yml +++ b/copier.yml @@ -3,12 +3,26 @@ directory_name: type: str default: my-python-project + help: Enter the name of the directory where the project will be created. + validator: >- + {% if not (directory_name | regex_search('^[a-z0-9\-]+$')) %} + directory_name must be lowercase, and can only contain letters, digits, and hyphens. + {% endif %} package_name: type: str default: my_python_package + help: Enter the name of the Python package. + validator: >- + {% if not (package_name | regex_search('^[a-z][a-z0-9\_]+$')) %} + package_name must start with a letter, followed one or more letters, digits or underscores all lowercase. + {% endif %} package_short_description: type: str default: Short description of package + # validator: >- + # {% if '"' in package_short_description %} + # package_short_description must not contain unescaped double quotes. Use \\" for double quotes. + # {% endif %} keyword1: type: str default: keyword1 @@ -35,6 +49,11 @@ license: full_name: type: str default: Jane Smith + help: Enter your full name. + # validator: >- + # {% if '"' in full_name %} + # full_name must not contain unescaped double quotes. Use \\" for double quotes. + # {% endif %} email: type: str default: yourname@esciencecenter.nl From 0d581db9dfb145bf195492beb357c911adb5c7ec Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Mon, 15 Jul 2024 12:03:10 +0200 Subject: [PATCH 2/2] Add generated variables --- copier.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/copier.yml b/copier.yml index 206f078..6e9edd6 100644 --- a/copier.yml +++ b/copier.yml @@ -62,8 +62,17 @@ copyright_holder: default: Netherlands eScience Center code_of_conduct_email: type: str - default: "{{ email }}" + default: {{ email }} _subdirectory: template +repository: + default: git@github.com:{{ github_organization }}/{{ directory_name }} + when: false + +repository_url: + default: https://github.com/{{ github_organization }}/{{ directory_name }} + when: false + + # Optional questions