mirror of
https://github.com/daylinmorgan/task.mk.git
synced 2024-11-09 19:13:14 -06:00
refactor: drop finicky quit-make function
This commit is contained in:
parent
e608a90b5a
commit
234e3cee35
6 changed files with 19 additions and 24 deletions
9
Makefile
9
Makefile
|
@ -1,9 +1,10 @@
|
||||||
VERSION ?= $(shell git describe --tags --always --dirty | sed s'/dirty/dev/')
|
VERSION ?= $(shell git describe --tags --always --dirty | sed s'/dirty/dev/')
|
||||||
TEMPLATES := $(shell find src/ -type f)
|
TEMPLATES := $(shell find src/ -type f)
|
||||||
.DEFAULT_GOAL := help
|
.DEFAULT_GOAL := help
|
||||||
|
SHELL := /bin/zsh
|
||||||
|
INHERIT_SHELL = true
|
||||||
|
msg = $(if $(tprint),$(call tprint,{a.bold}==> {a.magenta}$(1){a.end}),@echo '==> $(1)')
|
||||||
|
|
||||||
msgfmt = {a.style('==>','bold')} {a.style('$(1)','b_magenta')} {a.style('<==','bold')}
|
|
||||||
msg = $(call tprint,$(call msgfmt ,$(1)))
|
|
||||||
|
|
||||||
### task.mk development | args: -d -ms b_green --align center
|
### task.mk development | args: -d -ms b_green --align center
|
||||||
## bootstrap | generate local dev environment
|
## bootstrap | generate local dev environment
|
||||||
|
@ -73,8 +74,8 @@ define USAGE
|
||||||
endef
|
endef
|
||||||
|
|
||||||
EPILOG = \nfor more info: gh.dayl.in/task.mk
|
EPILOG = \nfor more info: gh.dayl.in/task.mk
|
||||||
PRINT_VARS := VERSION
|
PRINT_VARS := VERSION SHELL
|
||||||
-include .task.mk
|
-include .task.mk
|
||||||
.task.mk: $(TEMPLATES) generate.py
|
.task.mk: $(TEMPLATES) generate.py
|
||||||
$(call tprint,{a.b_yellow}re-jinjaing the local .task.mk{a.end})
|
$(call msg,re-jinjaing the local .task.mk)
|
||||||
@./generate.py $(VERSION) > .task.mk || (echo "generator failed!!" && rm .task.mk)
|
@./generate.py $(VERSION) > .task.mk || (echo "generator failed!!" && rm .task.mk)
|
||||||
|
|
|
@ -4,7 +4,7 @@ import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import jinja2
|
import jinja2
|
||||||
|
|
||||||
py_script_names = ["help", "ansi", "info", "print-ansi", "vars", "confirm", "quit_make"]
|
py_script_names = ["help", "ansi", "info", "print-ansi", "vars", "confirm"]
|
||||||
|
|
||||||
|
|
||||||
def get_jinja_env():
|
def get_jinja_env():
|
||||||
|
|
|
@ -4,9 +4,17 @@ ifeq (help,$(firstword $(MAKECMDGOALS)))
|
||||||
export HELP_ARGS
|
export HELP_ARGS
|
||||||
endif
|
endif
|
||||||
## h, help | show this help
|
## h, help | show this help
|
||||||
.PHONY: help h
|
ifdef HELP_ARGS
|
||||||
help h:
|
help: help-args
|
||||||
|
$(error exiting early)
|
||||||
|
.PHONY: help-args
|
||||||
|
help-args:
|
||||||
$(call py,help_py)
|
$(call py,help_py)
|
||||||
|
else
|
||||||
|
.PHONY: help h
|
||||||
|
h help:
|
||||||
|
$(call py,help_py)
|
||||||
|
endif
|
||||||
.PHONY: _help
|
.PHONY: _help
|
||||||
_help: export SHOW_HIDDEN=true
|
_help: export SHOW_HIDDEN=true
|
||||||
_help: help
|
_help: help
|
||||||
|
@ -32,5 +40,5 @@ _update-task.mk:
|
||||||
curl https://raw.githubusercontent.com/daylinmorgan/task.mk/main/task.mk -o .task.mk
|
curl https://raw.githubusercontent.com/daylinmorgan/task.mk/main/task.mk -o .task.mk
|
||||||
export MAKEFILE_LIST
|
export MAKEFILE_LIST
|
||||||
ifndef INHERIT_SHELL
|
ifndef INHERIT_SHELL
|
||||||
SHELL := /bin/bash
|
SHELL := $(shell which bash)
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
##- '$(ansi_py)' -##
|
##- '$(ansi_py)' -##
|
||||||
##- '$(quit_make_py)' -##
|
|
||||||
|
|
||||||
|
|
||||||
def confirm():
|
def confirm():
|
||||||
|
@ -23,5 +22,5 @@ def confirm():
|
||||||
if confirm():
|
if confirm():
|
||||||
sys.exit()
|
sys.exit()
|
||||||
else:
|
else:
|
||||||
quit_make()
|
sys.exit(1)
|
||||||
#% endblock %#
|
#% endblock %#
|
||||||
|
|
|
@ -7,7 +7,6 @@ import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
##- '$(ansi_py)' -##
|
##- '$(ansi_py)' -##
|
||||||
##- '$(quit_make_py)' -##
|
|
||||||
|
|
||||||
MaxLens = namedtuple("MaxLens", "goal msg")
|
MaxLens = namedtuple("MaxLens", "goal msg")
|
||||||
|
|
||||||
|
@ -157,8 +156,8 @@ def print_arg_help(help_args):
|
||||||
def main():
|
def main():
|
||||||
help_args = os.getenv("HELP_ARGS")
|
help_args = os.getenv("HELP_ARGS")
|
||||||
if help_args:
|
if help_args:
|
||||||
quit_make()
|
|
||||||
print_arg_help(help_args)
|
print_arg_help(help_args)
|
||||||
|
print(a.faint)
|
||||||
else:
|
else:
|
||||||
print_help()
|
print_help()
|
||||||
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
#% extends "py-script.mk" %#
|
|
||||||
#% block name %#quit_make#% endblock %#
|
|
||||||
#% block script %#
|
|
||||||
|
|
||||||
import os, signal
|
|
||||||
|
|
||||||
|
|
||||||
def quit_make():
|
|
||||||
os.kill(os.getppid(), signal.SIGQUIT)
|
|
||||||
|
|
||||||
|
|
||||||
#% endblock %#
|
|
Loading…
Reference in a new issue