Improving Makefile help menu
This commit is contained in:
parent
099c483324
commit
cfd771a740
1 changed files with 15 additions and 15 deletions
30
Makefile
30
Makefile
|
@ -1,29 +1,29 @@
|
|||
help:
|
||||
DESC_COLOR = \033[32m
|
||||
COMMAND_COLOR = \033[36m
|
||||
CLEAR_COLOR = \033[0m
|
||||
|
||||
.PHONY: help
|
||||
help: ## prints this message ##
|
||||
@echo ""; \
|
||||
echo "Usage: make <command>"; \
|
||||
echo ""; \
|
||||
echo "where <command> is one of the following:"; \
|
||||
echo ""; \
|
||||
echo "\thelp\tPrints this message"; \
|
||||
echo ""; \
|
||||
echo "\tstart\tdocker-compose up --build"; \
|
||||
echo "\t\t(starts the minecraft server)"; \
|
||||
echo ""; \
|
||||
echo "\tstop\tdocker-compose stop --rmi all --remove-orphans"; \
|
||||
echo "\t\t(stops and cleans up images, but keeps data)"; \
|
||||
echo ""; \
|
||||
echo "\tattach\tdocker attach mcserver"; \
|
||||
echo "\t\t(attaches to minecraft paper jar for issuing commands)";
|
||||
|
||||
start:
|
||||
grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
|
||||
perl -nle '/(.*?): ## (.*?) ## (.*$$)/; if ($$3 eq "") { printf ( "$(COMMAND_COLOR)%-20s$(DESC_COLOR)%s$(CLEAR_COLOR)\n\n", $$1, $$2) } else { printf ( "$(COMMAND_COLOR)%-20s$(DESC_COLOR)%s$(CLEAR_COLOR)\n%-20s%s\n\n", $$1, $$2, " ", $$3) }';
|
||||
|
||||
.PHONY: start
|
||||
start: ## docker-compose up --build ## (starts the minecraft server)
|
||||
@echo "Starting Minecraft Server..."; \
|
||||
docker-compose up -d --build;
|
||||
|
||||
stop:
|
||||
.PHONY: stop
|
||||
stop: ## docker-compose stop --rmi all --remove-orphans: ## (stops and cleans up images, but keeps data)
|
||||
@echo "Stopping Minecraft Server and cleaning up..."; \
|
||||
docker-compose down --rmi all --remove-orphans;
|
||||
|
||||
attach:
|
||||
.PHONY: attach
|
||||
attach: ## docker attach mcserver ## (attaches to minecraft paper jar for issuing commands)
|
||||
@echo "Attaching to Minecraft..."; \
|
||||
echo "Ctrl-C stops minecraft and exits"; \
|
||||
echo "Ctrl-P Ctrl-Q only exits"; \
|
||||
|
|
Loading…
Add table
Reference in a new issue