~jbauer/sbs

7afbde68cac22f2a9f6dce231f1048d87e07d411 — Jake Bauer a month ago 44f89f8 release
Add confirmation prompt in case something will be overwritten

This stops the user from accidentally overwriting a file full of content
or resetting a website directory when using commands such as 'sbs new
page' or 'sbs new site'.
1 files changed, 10 insertions(+), 0 deletions(-)

M sbs
M sbs => sbs +10 -0
@@ 26,6 26,16 @@ new()
		exit 1
	fi

	if [ -e "$3" ]; then
		printf "%s already exists. Doing this will overwrite it.\n" "$3"
		printf "Are you sure you want to overwrite it? (y/N): "
		read input
		input=$(echo "$input" | tr "[:upper:]" "[:lower:]")
		if [ "$input" != "y" ] && [ "$input" != "yes" ]; then
			return
		fi
	fi

	if [ "$2" = "page" ]; then
		{ printf "Title: \nSummary: \n\n"
		  printf "# [%%title]\n\n"