diff --git a/template-setup.sh b/template-setup.sh old mode 100644 new mode 100755 index 971fc85..477f36b --- a/template-setup.sh +++ b/template-setup.sh @@ -2,5 +2,36 @@ mv example.env .env -# Delete this script after running -rm -- "$0" +# Function to prompt for 'y' input +prompt_confirmation() { + local prompt_message="$1" + read -p "$prompt_message (y/n): " -n 1 -r + echo # Move to a new line + [[ $REPLY =~ ^[Yy]$ ]] +} + +# Check if 'just' command is available +if ! command -v just &> /dev/null +then + echo "'just' command not found. ๐Ÿคจ" + + # Ask to install 'just' + if prompt_confirmation "Do you want to install the 'just' command runner?" + then + cargo install just + echo "'just' has been installed." + else + echo "Installation of 'just' cancelled. Can't install tools. โŒ" + exit 1 + fi +fi + +# Ask to install tools using 'just' +if prompt_confirmation "Do you want to install tools (cargo-nextest, taplo-cli, cargo-watch, cargo-limit)?" +then + just install-tools + echo "Tools have been installed! ๐Ÿ‘ท" +else + echo "Tools installation cancelled. โŒ" + exit 1 +fi