From 6bcae13bccac2855c70dc3af6623d12abaaf85df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?n=CE=B9c=D0=BDola=D1=95=20w=CE=B9lde?= Date: Sat, 25 Jun 2022 06:34:29 +0000 Subject: [PATCH] Edit list-ingredients.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nιcнolaѕ wιlde --- Taskfile.yaml | 4 ++++ scripts/list-ingredients.sh | 21 ++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Taskfile.yaml b/Taskfile.yaml index 1f9829af4..182a14dc4 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -21,6 +21,10 @@ tasks: cmds: - task: markdownlint - task: yamllint + list-ingredients: + desc: List all ingredients in all cook recipes and copy to clipboard. + cmds: + - ./scripts/list-ingredients.sh markdownlint: desc: Run markdownlint-cli cmds: diff --git a/scripts/list-ingredients.sh b/scripts/list-ingredients.sh index a79840719..2e5c3f3ba 100755 --- a/scripts/list-ingredients.sh +++ b/scripts/list-ingredients.sh @@ -1,12 +1,27 @@ #!/bin/bash +################################################################################ +# +# boilerplate-bash +# ---------------- +# Copy cook shopping-list command to clipboard to list all ingredients in all +# cook recipes. +# +# @author Nicholas Wilde, 0x08b7d7a3 +# @date 24 Jun 2022 +# @version 0.0.1 +# +################################################################################ +set -e shopt -s globstar shopt -s dotglob nullglob dirs=( ../**/*.cook ) # glob the names +# Convert array to string and add double quotes around each file path to handle spaces printf -v dirs_d ' \"%s\"' "${dirs[@]}" dirs_d=${dirs_d:1} # remove the leading space -# printf '%s\n' "${dirs_d}" - -"cook shopping-list ${dirs_d}" +# Copy the command to the clipboard to avoid file name too long error +# Chromebook copy +# https://chromium.googlesource.com/apps/libapps/+/master/hterm/etc/osc52.sh +echo "cook shopping-list ${dirs_d}" | copy