Add columns and rows parameters

This commit is contained in:
The Magician 2024-03-07 13:35:02 +00:00
parent c5be149197
commit 26d0e38bec
1 changed files with 7 additions and 4 deletions

11
griddle
View File

@ -14,8 +14,8 @@ get_image_dimension() {
} }
main() { main() {
if test "$#" -ne 2; then if test "$#" -ne 4; then
printf "Usage: griddle <inputfile> <outputfile>\n" printf "Usage: griddle <inputfile> <columns> <rows> <outputfile>\n"
return 1 return 1
fi fi
@ -25,7 +25,10 @@ main() {
return 2 return 2
fi fi
outputfile="$2" columns="$2"
rows="$3"
outputfile="$4"
if test -e "$outputfile"; then if test -e "$outputfile"; then
printf "Output file $outputfile already exists. Overwrite? (y/N) " printf "Output file $outputfile already exists. Overwrite? (y/N) "
read response read response
@ -40,7 +43,7 @@ main() {
width="$(get_image_dimension $inputfile $WIDTH)" width="$(get_image_dimension $inputfile $WIDTH)"
height="$(get_image_dimension $inputfile $HEIGHT)" height="$(get_image_dimension $inputfile $HEIGHT)"
echo "$inputfile" "$outputfile" "Dimensions: $width x $height" echo "$inputfile" "columns: $columns" "rows: $rows" "$outputfile" "Dimensions: $width x $height"
} }
main "$@" main "$@"