mirror of
https://github.com/nicholaswilde/recipes.git
synced 2026-08-18 02:54:22 +00:00
41 lines
1.2 KiB
Bash
Executable File
41 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
||
|
||
################################################################################
|
||
#
|
||
# list_ingredients.sh
|
||
# ----------------
|
||
# List all ingredients in recipe files
|
||
#
|
||
# @author nιcнolaѕ wιlde, 0x08b7d7a3
|
||
# @date 23 Jun 2022
|
||
# @version 0.1.0
|
||
#
|
||
################################################################################
|
||
|
||
################################################################################
|
||
#
|
||
# boilerplate-bash
|
||
# ----------------
|
||
# Copy cook shopping-list command to clipboard to list all ingredients in all
|
||
# cook recipes.
|
||
#
|
||
# @author nιcнolaѕ wιlde, 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
|
||
|
||
# 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
|