scripts/quilt

29 lines
724 B
Bash
Executable File

#!/bin/bash
export GUM_INPUT_PROMPT_FOREGROUND="#04b575"
REL=$(gum input --prompt "Insert this tile in relation to which space? " --placeholder 1)
echo "Insert in which direction from this space?"
DIR=$(gum choose "Left" "Right" "Up" "Down")
if [[ $DIR == "Left" ]]; then
RDIR=W
elif [[ $DIR == "Right" ]]; then
RDIR=E
elif [[ $DIR == "Up" ]]; then
RDIR=N
elif [[ $DIR == "Down" ]]; then
RDIR=S
fi
QC=$(head -n -1 $1 | tail -n 5 | awk 'BEGIN{FS=""; OFS=FS} {$32=""; $1=""; print}' | tr -d '\n')
RAW="$REL$RDIR$QC"
echo "Quilt Tile:"
cat $1
echo "Raw:"
echo "$REL$RDIR$QC"
gum confirm "Submit this tile to the quilt, to the $DIR of $REL?" && echo "$REL$RDIR$QC" > /home/lab6/quilt || echo "Operation aborted."