From 8e7272c375b6d591ab1ab35c47c2c145fe7495c0 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Tue, 2 Apr 2024 10:11:32 +0200 Subject: Allow using description file without extension --- CHANGELOG.md | 5 +++++ lib/main.bash | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) 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 } -- cgit v1.1