#! /bin/bash

help() {
  echo "Resets permissions of a directory. Make sure you know what you're doing first."
	echo ""
	echo "These are the commands it runs:"
	echo `color 3 'sudo chmod -RN <DIRECTORY> && sudo chown -R <USERNAME> <DIRECTORY> && sudo chmod -R 755 <DIRECTORY>'`
	echo ""
  echo "`color 2 Usage:` reset-permissions <username> <directory>"
	echo ""
}

if [[ "$2" == '' ]]; then
	help
else

	USERNAME=$1
	DIR=$2
	sudo chmod -RN "${DIR}" && sudo chown -R ${USERNAME} "${DIR}" && sudo chmod -R 755 "${DIR}"

fi
