aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2024-04-02 10:11:32 +0200
committerPatrick Spek <p.spek@tyil.nl>2024-04-02 10:11:32 +0200
commit8e7272c375b6d591ab1ab35c47c2c145fe7495c0 (patch)
tree850540097f54aa2db19b8675462d24ea8fcb5569
parenta5808c579e2f967ff1a421a730d8b0224e9bfb62 (diff)
Allow using description file without extension
-rw-r--r--CHANGELOG.md5
-rw-r--r--lib/main.bash12
2 files changed, 16 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 157dc0e..ebc7f0f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
remove registry entries when a playbook itself has been deleted or is
otherwise broken in a way that the regular `del` subcommand cannot fix.
+### Changed
+
+- The `description.txt` is now allowed to be used without the `.txt` suffix.
+ Usage with the `.txt` suffix continues to be supported as well.
+
### Fixed
- Passing an empty string as default value to `config` should now properly
diff --git a/lib/main.bash b/lib/main.bash
index 196bbbf..821c2d2 100644
--- a/lib/main.bash
+++ b/lib/main.bash
@@ -138,9 +138,19 @@ EOF
# Render playbook descriptions
for playbook in "${playbooks[@]}"
do
+ local description=""
+
+ if [[ -f "$playbook/description.txt" ]]
+ then
+ description="$(cat "$playbook/description.txt")"
+ elif [[ -f "$playbook/description" ]]
+ then
+ description="$(cat "$playbook/description")"
+ fi
+
printf "\t%-${playbook_longest}s %s\n" \
"$(basename "$playbook")" \
- "$(cat "$playbook/description.txt")"
+ "$description"
done
}