From f75c2d1ff9afa9646de554ac7ea1e3fe5ad121e6 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Fri, 10 Mar 2023 07:37:15 +0100 Subject: Only show playbooks if the requisite directory exists --- lib/main.bash | 11 ++++++++--- 1 file 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 +# SPDX-FileCopyrightText: 2023 Patrick Spek # # 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"/* \ -- cgit v1.1