aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2023-03-10 07:37:15 +0100
committerPatrick Spek <p.spek@tyil.nl>2023-03-10 08:12:14 +0100
commitf75c2d1ff9afa9646de554ac7ea1e3fe5ad121e6 (patch)
tree072c218b0b1dfb9d335d54fc45eac1625e29b5bc
parent082d335fd41f5e951f3383a7bf5dfdbfdc8a93e4 (diff)
Only show playbooks if the requisite directory exists
-rw-r--r--lib/main.bash11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/main.bash b/lib/main.bash
index afcd58d..db5832e 100644
--- a/lib/main.bash
+++ b/lib/main.bash
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# SPDX-FileCopyrightText: 2022 Patrick Spek <p.spek@tyil.nl>
+# SPDX-FileCopyrightText: 2023 Patrick Spek <p.spek@tyil.nl>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
@@ -103,10 +103,15 @@ Commands:
playbooks.
sysinfo Show gathered information about this system.
var Show or set the value of a given configuration key.
-
-Playbooks:
EOF
+ if [[ ! -d "$BASHTARD_ETCDIR/playbooks.d" ]]
+ then
+ return 0
+ fi
+
+ printf "\nPlaybooks:\n"
+
# Find all playbooks
mapfile -t playbooks < <(find \
"$BASHTARD_ETCDIR/playbooks.d"/* \