about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-09-30 17:55:39 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-09-30 17:55:39 +0200
commitc87cd64616a833fda03deefdaa0623e9709cecbe (patch)
treea671672b4b6e01e79b900904786534f2705d5948
parentchore(version): v0.7.2 (diff)
downloadflake-templates-c87cd64616a833fda03deefdaa0623e9709cecbe.tar.gz
flake-templates-c87cd64616a833fda03deefdaa0623e9709cecbe.zip
fix(common/init): Only add a description when it exists
Otherwise, the default template would contain a extra "- " after the
name, when the description is left empty.
-rw-r--r--common/init8
1 files changed, 7 insertions, 1 deletions
diff --git a/common/init b/common/init
index 104bd30..9ee0462 100644
--- a/common/init
+++ b/common/init
@@ -125,6 +125,12 @@ fi
 prompt LICENSE_URL "The url of the license" "$default_license_url"
 
 if [ -e ./.reuse/templates/default.jinja2 ]; then
+    if [ -n "$DESCRIPTION" ]; then
+        description_str=" - $DESCRIPTION"
+    else
+        description_str=""
+    fi
+
     cat <<EOF | fmt --uniform-spacing --width=85 --split-only >./.reuse/templates/default.jinja2
 {% for copyright_line in copyright_lines %}
 {{ copyright_line }}
@@ -136,7 +142,7 @@ SPDX-FileContributor: {{ contributor_line }}
 SPDX-License-Identifier: {{ expression }}
 {% endfor %}
 
-This file is part of $APPLICATION_NAME_STYLIZED - $DESCRIPTION.
+This file is part of $APPLICATION_NAME_STYLIZED$description_str.
 
 You should have received a copy of the License along with this program.
 If not, see <$LICENSE_URL>.