chezmoi_dotfiles/dot_local/spells/executable_responseGatherer

34 lines
639 B
Bash

#!/bin/bash
# A simple shell script to make self reflection prompts easier.
declare -a PROMPTS
while getopts "i:o:" opt; do
case $opt in
i)
INPUT=$OPTARG;;
o)
OUTPUT=$OPTARG;;
esac
done
while read -r line; do
PROMPTS+=("$line")
done < $INPUT
[ ! -e $INPUT ] && echo "Invalid Input File" && exit 1
# If today's diary doesn't exist yet, it needs the standard date headeer
[ -e $OUTPUT ] || printf "%s \n" "# $(date +%F)" >> $OUTPUT
printf "%s \n" " " >> $OUTPUT
printf "%s \n" "## ${INPUT##*/}" "Entry Time: $(date +%R)" >> $OUTPUT
for p in "${PROMPTS[@]}"
do
read -p "$p " a
printf "%s %s\n" "$p $a" >> $OUTPUT
done