Created
March 16, 2018 21:33
-
-
Save KyleJamesWalker/18042731a63f2410c1be9c793cef951a to your computer and use it in GitHub Desktop.
Makefile Prompts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
something: | |
$(call prompt_run,echo "FUN!") | |
# Prompt the user to continue and exit the script if they choose no | |
define prompt_continue | |
@read -p "Contine and $(1)? " -n 1 -r REPLY; echo "\n"; \ | |
if [[ $$REPLY =~ ^[Nn]$$ ]]; then exit 1; fi | |
endef | |
# Prompt the user to run a given command, and keep going if they choose no | |
define prompt_run | |
@read -p "Run $(1)? " -n 1 -r REPLY; echo "\n"; \ | |
if [[ $$REPLY =~ ^[Yy]$$ ]]; then $(2); fi | |
endef |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment