Separate out continue behavior into askContinue function.

Add a step which asks if user wants to start with non-first frame
This commit is contained in:
Matt McWilliams 2021-09-16 09:51:42 -04:00
parent 1e59d667c8
commit 054a892cea
1 changed files with 26 additions and 16 deletions

40
draw.sh
View File

@ -1,5 +1,16 @@
#!/bin/bash
askContinue () {
echo "Are you ready to continue? (yes/no)"
read input
if [ "$input" != "n" ] && [ "$input" != "no" ]
then
echo "${1}"
else
exit 1
fi
}
if [[ "${1}" == "" ]]; then
echo "Please provide a directory as the first argument"
exit 1
@ -15,14 +26,19 @@ if [ "${2}" == "" ]; then
rm -f "${number}"
bash position.sh reset
echo "Are you ready to continue? (yes/no)"
read input
if [ "$input" != "n" ] && [ "$input" != "no" ]
then
echo "Starting with first frame..."
else
exit 1
askContinue "Starting with first frame..."
else
c=0
for svg in "${1}"*.svg ; do
if [ "${c}" != "${2}" ]; then
let "c=c+1"
continue
fi
filename=`basename "${svg}"`
echo "Starting frame: ${filename}"
break
done
askContinue "Continuing with frame ${filename}..."
fi
i=0
@ -44,13 +60,7 @@ for svg in "${1}"*.svg ; do
ax "${svg}"
rm -f "${number}"
bash position.sh reset
echo "Are you ready to continue? (yes/no)"
read input
if [ "$input" != "n" ] && [ "$input" != "no" ]
then
echo "Continuing with next frame..."
else
break
fi
askContinue "Continuing with next frame..."
done