mirror of
https://github.com/daylinmorgan/task.mk.git
synced 2024-12-22 01:50:44 -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/')
|
||||
TEMPLATES := $(shell find src/ -type f)
|
||||
.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
|
||||
## bootstrap | generate local dev environment
|
||||
|
@ -73,8 +74,8 @@ define USAGE
|
|||
endef
|
||||
|
||||
EPILOG = \nfor more info: gh.dayl.in/task.mk
|
||||
PRINT_VARS := VERSION
|
||||
PRINT_VARS := VERSION SHELL
|
||||
-include .task.mk
|
||||
.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)
|
||||
|
|
|
@ -4,7 +4,7 @@ import sys
|
|||
from pathlib import Path
|
||||
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():
|
||||
|
|
|
@ -4,9 +4,17 @@ ifeq (help,$(firstword $(MAKECMDGOALS)))
|
|||
export HELP_ARGS
|
||||
endif
|
||||
## h, help | show this help
|
||||
.PHONY: help h
|
||||
help h:
|
||||
ifdef HELP_ARGS
|
||||
help: help-args
|
||||
$(error exiting early)
|
||||
.PHONY: help-args
|
||||
help-args:
|
||||
$(call py,help_py)
|
||||
else
|
||||
.PHONY: help h
|
||||
h help:
|
||||
$(call py,help_py)
|
||||
endif
|
||||
.PHONY: _help
|
||||
_help: export SHOW_HIDDEN=true
|
||||
_help: help
|
||||
|
@ -32,5 +40,5 @@ _update-task.mk:
|
|||
curl https://raw.githubusercontent.com/daylinmorgan/task.mk/main/task.mk -o .task.mk
|
||||
export MAKEFILE_LIST
|
||||
ifndef INHERIT_SHELL
|
||||
SHELL := /bin/bash
|
||||
SHELL := $(shell which bash)
|
||||
endif
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
import sys
|
||||
|
||||
##- '$(ansi_py)' -##
|
||||
##- '$(quit_make_py)' -##
|
||||
|
||||
|
||||
def confirm():
|
||||
|
@ -23,5 +22,5 @@ def confirm():
|
|||
if confirm():
|
||||
sys.exit()
|
||||
else:
|
||||
quit_make()
|
||||
sys.exit(1)
|
||||
#% endblock %#
|
||||
|
|
|
@ -7,7 +7,6 @@ import os
|
|||
import re
|
||||
|
||||
##- '$(ansi_py)' -##
|
||||
##- '$(quit_make_py)' -##
|
||||
|
||||
MaxLens = namedtuple("MaxLens", "goal msg")
|
||||
|
||||
|
@ -157,8 +156,8 @@ def print_arg_help(help_args):
|
|||
def main():
|
||||
help_args = os.getenv("HELP_ARGS")
|
||||
if help_args:
|
||||
quit_make()
|
||||
print_arg_help(help_args)
|
||||
print(a.faint)
|
||||
else:
|
||||
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