mirror of
https://github.com/daylinmorgan/task.mk.git
synced 2024-11-09 11:03:15 -06:00
Compare commits
3 commits
18ff88b714
...
13c157ef8a
Author | SHA1 | Date | |
---|---|---|---|
13c157ef8a | |||
718fac7e3e | |||
2acb570a4e |
24 changed files with 3522 additions and 284 deletions
19
.github/workflows/docs.yml
vendored
Normal file
19
.github/workflows/docs.yml
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
name: docs
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.x
|
||||
- run: pip install mkdocs-material \
|
||||
mkdocs-git-revision-date-localized-plugin
|
||||
- run: mkdocs gh-deploy --force
|
||||
|
40
Makefile
40
Makefile
|
@ -41,19 +41,6 @@ release: version-check
|
|||
c clean:
|
||||
@rm -f task.mk .task.mk
|
||||
|
||||
### | args: --divider --whitespace
|
||||
### examples of task.mk features | args: --divider --align center --msg-style b_red
|
||||
define list_files_py
|
||||
from pathlib import Path
|
||||
print("files in $(2)")
|
||||
print([f.name for f in (Path("$(2)").iterdir())])
|
||||
endef
|
||||
|
||||
## list-% | use pathlib.Path to list files
|
||||
### name the directory in rule (make list-src) | args: --align sep
|
||||
list-%:
|
||||
$(call py,list_files_py,$*)
|
||||
|
||||
.PHONY: version-check
|
||||
version-check:
|
||||
@if [[ "${VERSION}" == *'-'* ]]; then\
|
||||
|
@ -67,24 +54,6 @@ version-check:
|
|||
fi
|
||||
|
||||
|
||||
define bash_script
|
||||
figlet task.mk 2>/dev/null || echo 'no figlet :('
|
||||
echo "This is from bash"
|
||||
cat /etc/hostname
|
||||
printf "%s\n" "$(2)"
|
||||
endef
|
||||
.PHONY: test-bash
|
||||
test-bash:
|
||||
$(call tbash,bash_script,bash multiline is probably working)
|
||||
|
||||
define mlmsg
|
||||
{a.b_yellow}
|
||||
It can even be multiline!{a.end}
|
||||
{a.style('and styles can be defined','red')}
|
||||
as python {a.bold}f-string{a.end} literals
|
||||
{a.end}
|
||||
endef
|
||||
|
||||
## info | demonstrate usage of tprint
|
||||
.PHONY: task
|
||||
info:
|
||||
|
@ -93,13 +62,6 @@ info:
|
|||
$(call tprint,$(mlmsg))
|
||||
$(call tprint,{a.custom(fg=(148, 255, 15),bg=(103, 2, 15))}Custom Colors TOO!{a.end})
|
||||
|
||||
## check | get user confirmation or exit
|
||||
.PHONY: check
|
||||
check:
|
||||
$(call tconfirm,Would you like to proceed?)
|
||||
@echo "you said yes!"
|
||||
|
||||
### | args: --divider
|
||||
|
||||
task.mk: $(TEMPLATES) generate.py
|
||||
./generate.py $(VERSION) > task.mk
|
||||
|
@ -114,7 +76,7 @@ define USAGE
|
|||
|
||||
endef
|
||||
|
||||
EPILOG = \nfor more info: github.com/daylinmorgan/task.mk
|
||||
EPILOG = \nfor more info: gh.dayl.in/task.mk
|
||||
PRINT_VARS := VERSION
|
||||
|
||||
-include .task.mk
|
||||
|
|
145
README.md
145
README.md
|
@ -42,150 +42,7 @@ You might also consider making it a consistently downloaded dependency if you pl
|
|||
$(if $(wildcard .task.mk),,.task.mk: ; curl -fsSL https://raw.githubusercontent.com/daylinmorgan/task.mk/v22.9.14/task.mk -o .task.mk)
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
`Task.mk` will add access to a recipe `help` (also aliased to `h`).
|
||||
In order to use `make help` to you will need to add some custom comments to your `Makefile`.
|
||||
|
||||
Deliberately, I don't get names from recipes themselves.
|
||||
This not only greatly simplifies the parsing but add's some opportunity to customize the output.
|
||||
Such as to document wildcard or redundant recipes.
|
||||
|
||||
You can place these anywhere, but I recommend adding these notes directly above their relevant recipes.
|
||||
The format is `## <recipe> | <msg>`
|
||||
|
||||
```make
|
||||
## build | build the project
|
||||
.PHONY: build
|
||||
build:
|
||||
...
|
||||
```
|
||||
|
||||
Now when you invoke `make help` it will parse these and generate your help output.
|
||||
|
||||
In addition to a generic help output you can expose some configuration settings with `make vars`.
|
||||
To do so define the variables you'd like to print with `PRINT_VARS := VAR1 VAR2 VAR3`.
|
||||
|
||||
In addition to the `help` and `vars` recipes you can use a custom make function to format your text for fancier output.
|
||||
For this there are two options depending on your needs `tprint` or `tprint-sh`. (`tprint-sh` is for use within a multiline sub-shell that has already been silenced, see the version-check rule of this project's `Makefile` for an example.)
|
||||
|
||||
|
||||
To use `tprint` you call it with the builtin `make` call function.
|
||||
It accepts only one argument: an unquoted f-string literal.
|
||||
All strings passed to `tprint` have access to an object `ansi` or `a` for simplicity.
|
||||
This stores ANSI escape codes which can be used to style your text.
|
||||
|
||||
```make
|
||||
## build | compile the source
|
||||
.PHONY: build
|
||||
build:
|
||||
$(call tprint,{a.cyan}Build Starting{a.end})
|
||||
...
|
||||
$(call tprint,{a.green}Build Finished{a.end})
|
||||
```
|
||||
See this projects `make info` for more examples of `tprint`.
|
||||
|
||||
To see the available colors and formatting(bold,italic,etc.) use the hidden recipe `make _print-ansi`.
|
||||
|
||||
**Note**: Any help commands starting with an underscore will be ignored.
|
||||
To view hidden `tasks` (or recipes in GNU Make land) you can use `make _help`.
|
||||
|
||||
In addition, you can use custom colors using the builtin `ansi.custom` or (`a.custom`) method.
|
||||
It has two optional arguments `fg` and `bg`. Which can be used to specify either an 8-bit color from the [256 colors](https://en.wikipedia.org/wiki/8-bit_color).
|
||||
Or a tuple/list to define an RBG 24-bit color, for instance `a.custom(fg=(5,10,255))`.
|
||||
See this project's `make info` for an example.
|
||||
|
||||
## Configuration
|
||||
|
||||
You can quickly customize some of the default behavior of `task.mk` by overriding the below variables prior to the `-include .task.mk`.
|
||||
|
||||
```make
|
||||
# ---- CONFIG ---- #
|
||||
HEADER_STYLE ?= b_cyan
|
||||
PARAMS_STYLE ?= b_magenta
|
||||
ACCENT_STYLE ?= b_yellow
|
||||
GOAL_STYLE ?= $(ACCENT_STYLE)
|
||||
MSG_STYLE ?= faint
|
||||
DIVIDER_STYLE ?= default
|
||||
DIVIDER ?= ─
|
||||
HELP_SEP ?= │
|
||||
|
||||
# python f-string literals
|
||||
EPILOG ?=
|
||||
define USAGE ?=
|
||||
{ansi.$(HEADER_STYLE)}usage{ansi.end}:
|
||||
make <recipe>
|
||||
|
||||
endef
|
||||
```
|
||||
|
||||
To use a custom color for one of the predefined configuration variables specify only the custom method.
|
||||
|
||||
```make
|
||||
HEADER_STYLE = custom(fg=171,bg=227)
|
||||
```
|
||||
|
||||
**NOTE**: `HELP_SEP` does not change the argument definitions syntax only the format of `make help`.
|
||||
|
||||
## Advanced Usage: Embedded Python Scripts
|
||||
|
||||
You can take advantage of the builtin python script runner and write multi-line python scripts of your own.
|
||||
This is a simple example but a few lines of python in your `Makefile`
|
||||
may be easier than balancing sub-shells and strung together awk commands.
|
||||
|
||||
When `make` expands the function it will take the parameters passed to `py` and expand them.
|
||||
`$(1)` is the variable name and `$(2)` in this case is the implicit pattern from the rule. Pay attention to quotes.
|
||||
If you need to debug your python script, use `DEBUG=1` when you run `make` and it will first print the script that will be piped to `python`.
|
||||
|
||||
```make
|
||||
define list_files_py
|
||||
from pathlib import Path
|
||||
print("files in $(2)")
|
||||
print([f.name for f in (Path("$(2)").iterdir())])
|
||||
endef
|
||||
|
||||
## list-% | use pathlib.Path to list files
|
||||
list-%:
|
||||
$(call py,list_files_py,$*)
|
||||
```
|
||||
|
||||
For what it's worth there is also a predefined function for `bash` (named `tbash`) as well should you need to accomplish something similar of more easily embedding your bash script rather than having to escape every line with a backslash.
|
||||
|
||||
```make
|
||||
define bash_script
|
||||
figlet task.mk 2>/dev/null || echo 'no figlet :('
|
||||
echo "This is from bash"
|
||||
cat /etc/hostname
|
||||
printf "%s\n" "$(2)"
|
||||
endef
|
||||
.PHONY: test-bash
|
||||
test-bash:
|
||||
$(call tbash,bash_script,test bash multiline)
|
||||
```
|
||||
|
||||
|
||||
## Zsh Completions for GNU Make
|
||||
|
||||
If you use `GNU Make` with zsh you may want to add the following
|
||||
line to your rc file to allow `make` to handle the autocomplete.
|
||||
|
||||
```zsh
|
||||
zstyle ':completion::complete:make:*:targets' call-command true
|
||||
```
|
||||
|
||||
## Why Make?
|
||||
|
||||
There are lot of `GNU Make` alternatives but none have near the same level of ubiquity.
|
||||
This project attaches to `make` some of the native features of [`just`](https://github.com/casey/just), a command runner.
|
||||
|
||||
Just is a great task runner, but it suffers two problems, users probably don't have it installed already, and there is no way to define file specific recipes.
|
||||
Most of my `Makefile`'s are comprised primarily of handy `.PHONY` recipes, but I always end up with a few file specific recipes.
|
||||
|
||||
Another interesting project I've evaluated for these purposes is [`go-task/task`](https://github.com/go-task/task).
|
||||
`Task` has many of the features of `GNU Make` and some novel features of it's own.
|
||||
But like `just` it's a tool people don't usually already have and it's configured using a `yaml` file.
|
||||
`Yaml` files can be finicky to work with and and it uses a golang based shell runtime, not your native shell, which might lead to unexpected behavior.
|
||||
|
||||
For more info see the [documentation](https://gh.dayl.in/task.mk).
|
||||
|
||||
## Simpler Alternative
|
||||
|
||||
|
|
167
assets/help.svg
167
assets/help.svg
|
@ -1,4 +1,4 @@
|
|||
<svg class="rich-terminal shadow" viewBox="0 0 720.3333333333334 716.7333333333333" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg class="rich-terminal shadow" viewBox="0 0 573.3333333333334 521.5333333333333" xmlns="http://www.w3.org/2000/svg">
|
||||
<!-- Generated with Rich https://www.textualize.io -->
|
||||
<style>
|
||||
@font-face {
|
||||
|
@ -16,14 +16,14 @@
|
|||
font-weight: 700;
|
||||
}
|
||||
|
||||
.terminal-1053897658-matrix {
|
||||
.terminal-3882219697-matrix {
|
||||
font-family: Fira Code, monospace;
|
||||
font-size: 20px;
|
||||
line-height: 24.4px;
|
||||
font-variant-east-asian: full-width;
|
||||
}
|
||||
|
||||
.terminal-1053897658-title {
|
||||
.terminal-3882219697-title {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
font-family: arial;
|
||||
|
@ -33,133 +33,100 @@
|
|||
-webkit-filter: drop-shadow( 2px 5px 2px rgba(0, 0, 0, .7));
|
||||
filter: drop-shadow( 2px 5px 2px rgba(0, 0, 0, .7));
|
||||
}
|
||||
.terminal-1053897658-r1 { fill: #94e2d5;font-weight: bold }
|
||||
.terminal-1053897658-r2 { fill: #c6d0f5 }
|
||||
.terminal-1053897658-r3 { fill: #f5c2e7;font-weight: bold }
|
||||
.terminal-1053897658-r4 { fill: #c6d0f5;font-style: italic;;text-decoration: underline; }
|
||||
.terminal-1053897658-r5 { fill: #a6e3a1;font-weight: bold }
|
||||
.terminal-1053897658-r6 { fill: #f9e2af;font-weight: bold }
|
||||
.terminal-1053897658-r7 { fill: #8288a5 }
|
||||
.terminal-1053897658-r8 { fill: #f38ba8;font-weight: bold }
|
||||
.terminal-3882219697-r1 { fill: #94e2d5;font-weight: bold }
|
||||
.terminal-3882219697-r2 { fill: #c6d0f5 }
|
||||
.terminal-3882219697-r3 { fill: #f5c2e7;font-weight: bold }
|
||||
.terminal-3882219697-r4 { fill: #c6d0f5;font-style: italic;;text-decoration: underline; }
|
||||
.terminal-3882219697-r5 { fill: #a6e3a1;font-weight: bold }
|
||||
.terminal-3882219697-r6 { fill: #f9e2af;font-weight: bold }
|
||||
.terminal-3882219697-r7 { fill: #8288a5 }
|
||||
</style>
|
||||
|
||||
<defs>
|
||||
<clipPath id="terminal-1053897658-clip-terminal">
|
||||
<rect x="0" y="0" width="682.1999999999999" height="633.4" />
|
||||
<clipPath id="terminal-3882219697-clip-terminal">
|
||||
<rect x="0" y="0" width="535.8" height="438.2" />
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-0">
|
||||
<rect x="0" y="1.5" width="683.2" height="24.65"/>
|
||||
<clipPath id="terminal-3882219697-line-0">
|
||||
<rect x="0" y="1.5" width="536.8" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-1">
|
||||
<rect x="0" y="25.9" width="683.2" height="24.65"/>
|
||||
<clipPath id="terminal-3882219697-line-1">
|
||||
<rect x="0" y="25.9" width="536.8" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-2">
|
||||
<rect x="0" y="50.3" width="683.2" height="24.65"/>
|
||||
<clipPath id="terminal-3882219697-line-2">
|
||||
<rect x="0" y="50.3" width="536.8" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-3">
|
||||
<rect x="0" y="74.7" width="683.2" height="24.65"/>
|
||||
<clipPath id="terminal-3882219697-line-3">
|
||||
<rect x="0" y="74.7" width="536.8" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-4">
|
||||
<rect x="0" y="99.1" width="683.2" height="24.65"/>
|
||||
<clipPath id="terminal-3882219697-line-4">
|
||||
<rect x="0" y="99.1" width="536.8" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-5">
|
||||
<rect x="0" y="123.5" width="683.2" height="24.65"/>
|
||||
<clipPath id="terminal-3882219697-line-5">
|
||||
<rect x="0" y="123.5" width="536.8" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-6">
|
||||
<rect x="0" y="147.9" width="683.2" height="24.65"/>
|
||||
<clipPath id="terminal-3882219697-line-6">
|
||||
<rect x="0" y="147.9" width="536.8" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-7">
|
||||
<rect x="0" y="172.3" width="683.2" height="24.65"/>
|
||||
<clipPath id="terminal-3882219697-line-7">
|
||||
<rect x="0" y="172.3" width="536.8" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-8">
|
||||
<rect x="0" y="196.7" width="683.2" height="24.65"/>
|
||||
<clipPath id="terminal-3882219697-line-8">
|
||||
<rect x="0" y="196.7" width="536.8" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-9">
|
||||
<rect x="0" y="221.1" width="683.2" height="24.65"/>
|
||||
<clipPath id="terminal-3882219697-line-9">
|
||||
<rect x="0" y="221.1" width="536.8" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-10">
|
||||
<rect x="0" y="245.5" width="683.2" height="24.65"/>
|
||||
<clipPath id="terminal-3882219697-line-10">
|
||||
<rect x="0" y="245.5" width="536.8" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-11">
|
||||
<rect x="0" y="269.9" width="683.2" height="24.65"/>
|
||||
<clipPath id="terminal-3882219697-line-11">
|
||||
<rect x="0" y="269.9" width="536.8" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-12">
|
||||
<rect x="0" y="294.3" width="683.2" height="24.65"/>
|
||||
<clipPath id="terminal-3882219697-line-12">
|
||||
<rect x="0" y="294.3" width="536.8" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-13">
|
||||
<rect x="0" y="318.7" width="683.2" height="24.65"/>
|
||||
<clipPath id="terminal-3882219697-line-13">
|
||||
<rect x="0" y="318.7" width="536.8" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-14">
|
||||
<rect x="0" y="343.1" width="683.2" height="24.65"/>
|
||||
<clipPath id="terminal-3882219697-line-14">
|
||||
<rect x="0" y="343.1" width="536.8" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-15">
|
||||
<rect x="0" y="367.5" width="683.2" height="24.65"/>
|
||||
<clipPath id="terminal-3882219697-line-15">
|
||||
<rect x="0" y="367.5" width="536.8" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-16">
|
||||
<rect x="0" y="391.9" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-17">
|
||||
<rect x="0" y="416.3" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-18">
|
||||
<rect x="0" y="440.7" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-19">
|
||||
<rect x="0" y="465.1" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-20">
|
||||
<rect x="0" y="489.5" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-21">
|
||||
<rect x="0" y="513.9" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-22">
|
||||
<rect x="0" y="538.3" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-23">
|
||||
<rect x="0" y="562.7" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-24">
|
||||
<rect x="0" y="587.1" width="683.2" height="24.65"/>
|
||||
<clipPath id="terminal-3882219697-line-16">
|
||||
<rect x="0" y="391.9" width="536.8" height="24.65"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
|
||||
<rect fill="#1e1e2e" stroke="rgba(255,255,255,0.35)" stroke-width="1" x="10.1667" y="1" width="700" height="682.4" rx="8"/><text class="terminal-1053897658-title" fill="#c6d0f5" text-anchor="middle" x="350" y="27">make help</text>
|
||||
<rect fill="#1e1e2e" stroke="rgba(255,255,255,0.35)" stroke-width="1" x="10.1667" y="1" width="553" height="487.2" rx="8"/><text class="terminal-3882219697-title" fill="#c6d0f5" text-anchor="middle" x="276" y="27">make help</text>
|
||||
<g transform="translate(32,22)">
|
||||
<circle cx="0" cy="0" r="7" fill="#ff5f57"/>
|
||||
<circle cx="22" cy="0" r="7" fill="#febc2e"/>
|
||||
<circle cx="44" cy="0" r="7" fill="#28c840"/>
|
||||
</g>
|
||||
|
||||
<g transform="translate(18.166666666666664, 41) scale(.95)" clip-path="url(#terminal-1053897658-clip-terminal)">
|
||||
<g transform="translate(18.166666666666664, 41) scale(.95)" clip-path="url(#terminal-3882219697-clip-terminal)">
|
||||
|
||||
<g class="terminal-1053897658-matrix">
|
||||
<text class="terminal-1053897658-r1" x="0" y="20" textLength="73.2" clip-path="url(#terminal-1053897658-line-0)">usage:</text><text class="terminal-1053897658-r2" x="683.2" y="20" textLength="12.2" clip-path="url(#terminal-1053897658-line-0)">
|
||||
</text><text class="terminal-1053897658-r2" x="97.6" y="44.4" textLength="158.6" clip-path="url(#terminal-1053897658-line-1)">make <recipe></text><text class="terminal-1053897658-r2" x="683.2" y="44.4" textLength="12.2" clip-path="url(#terminal-1053897658-line-1)">
|
||||
</text><text class="terminal-1053897658-r2" x="683.2" y="68.8" textLength="12.2" clip-path="url(#terminal-1053897658-line-2)">
|
||||
</text><text class="terminal-1053897658-r2" x="0" y="93.2" textLength="146.4" clip-path="url(#terminal-1053897658-line-3)">  Turn your </text><text class="terminal-1053897658-r3" x="146.4" y="93.2" textLength="122" clip-path="url(#terminal-1053897658-line-3)">`Makefile`</text><text class="terminal-1053897658-r2" x="268.4" y="93.2" textLength="61" clip-path="url(#terminal-1053897658-line-3)"> into</text><text class="terminal-1053897658-r2" x="683.2" y="93.2" textLength="12.2" clip-path="url(#terminal-1053897658-line-3)">
|
||||
</text><text class="terminal-1053897658-r2" x="0" y="117.6" textLength="73.2" clip-path="url(#terminal-1053897658-line-4)">  the </text><text class="terminal-1053897658-r4" x="73.2" y="117.6" textLength="134.2" clip-path="url(#terminal-1053897658-line-4)">task runner</text><text class="terminal-1053897658-r2" x="207.4" y="117.6" textLength="231.8" clip-path="url(#terminal-1053897658-line-4)"> you always needed.</text><text class="terminal-1053897658-r2" x="683.2" y="117.6" textLength="12.2" clip-path="url(#terminal-1053897658-line-4)">
|
||||
</text><text class="terminal-1053897658-r2" x="0" y="142" textLength="378.2" clip-path="url(#terminal-1053897658-line-5)">  See the example output below.</text><text class="terminal-1053897658-r2" x="683.2" y="142" textLength="12.2" clip-path="url(#terminal-1053897658-line-5)">
|
||||
</text><text class="terminal-1053897658-r2" x="683.2" y="166.4" textLength="12.2" clip-path="url(#terminal-1053897658-line-6)">
|
||||
</text><text class="terminal-1053897658-r5" x="24.4" y="190.8" textLength="475.8" clip-path="url(#terminal-1053897658-line-7)">          task.mk development          </text><text class="terminal-1053897658-r2" x="683.2" y="190.8" textLength="12.2" clip-path="url(#terminal-1053897658-line-7)">
|
||||
</text><text class="terminal-1053897658-r2" x="0" y="215.2" textLength="536.8" clip-path="url(#terminal-1053897658-line-8)">  ──────────────────────────────────────────</text><text class="terminal-1053897658-r2" x="683.2" y="215.2" textLength="12.2" clip-path="url(#terminal-1053897658-line-8)">
|
||||
</text><text class="terminal-1053897658-r6" x="0" y="239.6" textLength="134.2" clip-path="url(#terminal-1053897658-line-9)">  bootstrap</text><text class="terminal-1053897658-r2" x="134.2" y="239.6" textLength="36.6" clip-path="url(#terminal-1053897658-line-9)"> │ </text><text class="terminal-1053897658-r7" x="170.8" y="239.6" textLength="366" clip-path="url(#terminal-1053897658-line-9)">generate local dev environment</text><text class="terminal-1053897658-r2" x="683.2" y="239.6" textLength="12.2" clip-path="url(#terminal-1053897658-line-9)">
|
||||
</text><text class="terminal-1053897658-r6" x="0" y="264" textLength="134.2" clip-path="url(#terminal-1053897658-line-10)">    l, lint</text><text class="terminal-1053897658-r2" x="134.2" y="264" textLength="36.6" clip-path="url(#terminal-1053897658-line-10)"> │ </text><text class="terminal-1053897658-r7" x="170.8" y="264" textLength="183" clip-path="url(#terminal-1053897658-line-10)">lint the python</text><text class="terminal-1053897658-r2" x="683.2" y="264" textLength="12.2" clip-path="url(#terminal-1053897658-line-10)">
|
||||
</text><text class="terminal-1053897658-r6" x="0" y="288.4" textLength="134.2" clip-path="url(#terminal-1053897658-line-11)">     assets</text><text class="terminal-1053897658-r2" x="134.2" y="288.4" textLength="36.6" clip-path="url(#terminal-1053897658-line-11)"> │ </text><text class="terminal-1053897658-r7" x="170.8" y="288.4" textLength="183" clip-path="url(#terminal-1053897658-line-11)">generate assets</text><text class="terminal-1053897658-r2" x="683.2" y="288.4" textLength="12.2" clip-path="url(#terminal-1053897658-line-11)">
|
||||
</text><text class="terminal-1053897658-r6" x="0" y="312.8" textLength="134.2" clip-path="url(#terminal-1053897658-line-12)">    release</text><text class="terminal-1053897658-r2" x="134.2" y="312.8" textLength="36.6" clip-path="url(#terminal-1053897658-line-12)"> │ </text><text class="terminal-1053897658-r7" x="170.8" y="312.8" textLength="366" clip-path="url(#terminal-1053897658-line-12)">release new version of task.mk</text><text class="terminal-1053897658-r2" x="683.2" y="312.8" textLength="12.2" clip-path="url(#terminal-1053897658-line-12)">
|
||||
</text><text class="terminal-1053897658-r6" x="0" y="337.2" textLength="134.2" clip-path="url(#terminal-1053897658-line-13)">   c, clean</text><text class="terminal-1053897658-r2" x="134.2" y="337.2" textLength="36.6" clip-path="url(#terminal-1053897658-line-13)"> │ </text><text class="terminal-1053897658-r7" x="170.8" y="337.2" textLength="317.2" clip-path="url(#terminal-1053897658-line-13)">remove the generated files</text><text class="terminal-1053897658-r2" x="683.2" y="337.2" textLength="12.2" clip-path="url(#terminal-1053897658-line-13)">
|
||||
</text><text class="terminal-1053897658-r2" x="0" y="361.6" textLength="536.8" clip-path="url(#terminal-1053897658-line-14)">  ──────────────────────────────────────────</text><text class="terminal-1053897658-r2" x="683.2" y="361.6" textLength="12.2" clip-path="url(#terminal-1053897658-line-14)">
|
||||
</text><text class="terminal-1053897658-r2" x="683.2" y="386" textLength="12.2" clip-path="url(#terminal-1053897658-line-15)">
|
||||
</text><text class="terminal-1053897658-r8" x="24.4" y="410.4" textLength="475.8" clip-path="url(#terminal-1053897658-line-16)">      examples of task.mk features     </text><text class="terminal-1053897658-r2" x="683.2" y="410.4" textLength="12.2" clip-path="url(#terminal-1053897658-line-16)">
|
||||
</text><text class="terminal-1053897658-r2" x="0" y="434.8" textLength="536.8" clip-path="url(#terminal-1053897658-line-17)">  ──────────────────────────────────────────</text><text class="terminal-1053897658-r2" x="683.2" y="434.8" textLength="12.2" clip-path="url(#terminal-1053897658-line-17)">
|
||||
</text><text class="terminal-1053897658-r6" x="0" y="459.2" textLength="134.2" clip-path="url(#terminal-1053897658-line-18)">     list-%</text><text class="terminal-1053897658-r2" x="134.2" y="459.2" textLength="36.6" clip-path="url(#terminal-1053897658-line-18)"> │ </text><text class="terminal-1053897658-r7" x="170.8" y="459.2" textLength="366" clip-path="url(#terminal-1053897658-line-18)">use pathlib.Path to list files</text><text class="terminal-1053897658-r2" x="683.2" y="459.2" textLength="12.2" clip-path="url(#terminal-1053897658-line-18)">
|
||||
</text><text class="terminal-1053897658-r7" x="170.8" y="483.6" textLength="512.4" clip-path="url(#terminal-1053897658-line-19)">name the directory in rule (make list-src)</text><text class="terminal-1053897658-r2" x="683.2" y="483.6" textLength="12.2" clip-path="url(#terminal-1053897658-line-19)">
|
||||
</text><text class="terminal-1053897658-r6" x="0" y="508" textLength="134.2" clip-path="url(#terminal-1053897658-line-20)">       info</text><text class="terminal-1053897658-r2" x="134.2" y="508" textLength="36.6" clip-path="url(#terminal-1053897658-line-20)"> │ </text><text class="terminal-1053897658-r7" x="170.8" y="508" textLength="329.4" clip-path="url(#terminal-1053897658-line-20)">demonstrate usage of tprint</text><text class="terminal-1053897658-r2" x="683.2" y="508" textLength="12.2" clip-path="url(#terminal-1053897658-line-20)">
|
||||
</text><text class="terminal-1053897658-r6" x="0" y="532.4" textLength="134.2" clip-path="url(#terminal-1053897658-line-21)">      check</text><text class="terminal-1053897658-r2" x="134.2" y="532.4" textLength="36.6" clip-path="url(#terminal-1053897658-line-21)"> │ </text><text class="terminal-1053897658-r7" x="170.8" y="532.4" textLength="353.8" clip-path="url(#terminal-1053897658-line-21)">get user confirmation or exit</text><text class="terminal-1053897658-r2" x="683.2" y="532.4" textLength="12.2" clip-path="url(#terminal-1053897658-line-21)">
|
||||
</text><text class="terminal-1053897658-r2" x="0" y="556.8" textLength="536.8" clip-path="url(#terminal-1053897658-line-22)">  ──────────────────────────────────────────</text><text class="terminal-1053897658-r2" x="683.2" y="556.8" textLength="12.2" clip-path="url(#terminal-1053897658-line-22)">
|
||||
</text><text class="terminal-1053897658-r6" x="0" y="581.2" textLength="134.2" clip-path="url(#terminal-1053897658-line-23)">    h, help</text><text class="terminal-1053897658-r2" x="134.2" y="581.2" textLength="36.6" clip-path="url(#terminal-1053897658-line-23)"> │ </text><text class="terminal-1053897658-r7" x="170.8" y="581.2" textLength="170.8" clip-path="url(#terminal-1053897658-line-23)">show this help</text><text class="terminal-1053897658-r2" x="683.2" y="581.2" textLength="12.2" clip-path="url(#terminal-1053897658-line-23)">
|
||||
</text><text class="terminal-1053897658-r2" x="683.2" y="605.6" textLength="12.2" clip-path="url(#terminal-1053897658-line-24)">
|
||||
</text><text class="terminal-1053897658-r2" x="0" y="630" textLength="561.2" clip-path="url(#terminal-1053897658-line-25)">for more info: github.com/daylinmorgan/task.mk</text><text class="terminal-1053897658-r2" x="683.2" y="630" textLength="12.2" clip-path="url(#terminal-1053897658-line-25)">
|
||||
<g class="terminal-3882219697-matrix">
|
||||
<text class="terminal-3882219697-r1" x="0" y="20" textLength="73.2" clip-path="url(#terminal-3882219697-line-0)">usage:</text><text class="terminal-3882219697-r2" x="536.8" y="20" textLength="12.2" clip-path="url(#terminal-3882219697-line-0)">
|
||||
</text><text class="terminal-3882219697-r2" x="97.6" y="44.4" textLength="158.6" clip-path="url(#terminal-3882219697-line-1)">make <recipe></text><text class="terminal-3882219697-r2" x="536.8" y="44.4" textLength="12.2" clip-path="url(#terminal-3882219697-line-1)">
|
||||
</text><text class="terminal-3882219697-r2" x="536.8" y="68.8" textLength="12.2" clip-path="url(#terminal-3882219697-line-2)">
|
||||
</text><text class="terminal-3882219697-r2" x="0" y="93.2" textLength="146.4" clip-path="url(#terminal-3882219697-line-3)">  Turn your </text><text class="terminal-3882219697-r3" x="146.4" y="93.2" textLength="122" clip-path="url(#terminal-3882219697-line-3)">`Makefile`</text><text class="terminal-3882219697-r2" x="268.4" y="93.2" textLength="61" clip-path="url(#terminal-3882219697-line-3)"> into</text><text class="terminal-3882219697-r2" x="536.8" y="93.2" textLength="12.2" clip-path="url(#terminal-3882219697-line-3)">
|
||||
</text><text class="terminal-3882219697-r2" x="0" y="117.6" textLength="73.2" clip-path="url(#terminal-3882219697-line-4)">  the </text><text class="terminal-3882219697-r4" x="73.2" y="117.6" textLength="134.2" clip-path="url(#terminal-3882219697-line-4)">task runner</text><text class="terminal-3882219697-r2" x="207.4" y="117.6" textLength="231.8" clip-path="url(#terminal-3882219697-line-4)"> you always needed.</text><text class="terminal-3882219697-r2" x="536.8" y="117.6" textLength="12.2" clip-path="url(#terminal-3882219697-line-4)">
|
||||
</text><text class="terminal-3882219697-r2" x="0" y="142" textLength="378.2" clip-path="url(#terminal-3882219697-line-5)">  See the example output below.</text><text class="terminal-3882219697-r2" x="536.8" y="142" textLength="12.2" clip-path="url(#terminal-3882219697-line-5)">
|
||||
</text><text class="terminal-3882219697-r2" x="536.8" y="166.4" textLength="12.2" clip-path="url(#terminal-3882219697-line-6)">
|
||||
</text><text class="terminal-3882219697-r5" x="24.4" y="190.8" textLength="475.8" clip-path="url(#terminal-3882219697-line-7)">          task.mk development          </text><text class="terminal-3882219697-r2" x="536.8" y="190.8" textLength="12.2" clip-path="url(#terminal-3882219697-line-7)">
|
||||
</text><text class="terminal-3882219697-r2" x="0" y="215.2" textLength="536.8" clip-path="url(#terminal-3882219697-line-8)">  ──────────────────────────────────────────</text><text class="terminal-3882219697-r2" x="536.8" y="215.2" textLength="12.2" clip-path="url(#terminal-3882219697-line-8)">
|
||||
</text><text class="terminal-3882219697-r6" x="0" y="239.6" textLength="134.2" clip-path="url(#terminal-3882219697-line-9)">  bootstrap</text><text class="terminal-3882219697-r2" x="134.2" y="239.6" textLength="36.6" clip-path="url(#terminal-3882219697-line-9)"> │ </text><text class="terminal-3882219697-r7" x="170.8" y="239.6" textLength="366" clip-path="url(#terminal-3882219697-line-9)">generate local dev environment</text><text class="terminal-3882219697-r2" x="536.8" y="239.6" textLength="12.2" clip-path="url(#terminal-3882219697-line-9)">
|
||||
</text><text class="terminal-3882219697-r6" x="0" y="264" textLength="134.2" clip-path="url(#terminal-3882219697-line-10)">    l, lint</text><text class="terminal-3882219697-r2" x="134.2" y="264" textLength="36.6" clip-path="url(#terminal-3882219697-line-10)"> │ </text><text class="terminal-3882219697-r7" x="170.8" y="264" textLength="183" clip-path="url(#terminal-3882219697-line-10)">lint the python</text><text class="terminal-3882219697-r2" x="536.8" y="264" textLength="12.2" clip-path="url(#terminal-3882219697-line-10)">
|
||||
</text><text class="terminal-3882219697-r6" x="0" y="288.4" textLength="134.2" clip-path="url(#terminal-3882219697-line-11)">     assets</text><text class="terminal-3882219697-r2" x="134.2" y="288.4" textLength="36.6" clip-path="url(#terminal-3882219697-line-11)"> │ </text><text class="terminal-3882219697-r7" x="170.8" y="288.4" textLength="183" clip-path="url(#terminal-3882219697-line-11)">generate assets</text><text class="terminal-3882219697-r2" x="536.8" y="288.4" textLength="12.2" clip-path="url(#terminal-3882219697-line-11)">
|
||||
</text><text class="terminal-3882219697-r6" x="0" y="312.8" textLength="134.2" clip-path="url(#terminal-3882219697-line-12)">    release</text><text class="terminal-3882219697-r2" x="134.2" y="312.8" textLength="36.6" clip-path="url(#terminal-3882219697-line-12)"> │ </text><text class="terminal-3882219697-r7" x="170.8" y="312.8" textLength="366" clip-path="url(#terminal-3882219697-line-12)">release new version of task.mk</text><text class="terminal-3882219697-r2" x="536.8" y="312.8" textLength="12.2" clip-path="url(#terminal-3882219697-line-12)">
|
||||
</text><text class="terminal-3882219697-r6" x="0" y="337.2" textLength="134.2" clip-path="url(#terminal-3882219697-line-13)">   c, clean</text><text class="terminal-3882219697-r2" x="134.2" y="337.2" textLength="36.6" clip-path="url(#terminal-3882219697-line-13)"> │ </text><text class="terminal-3882219697-r7" x="170.8" y="337.2" textLength="317.2" clip-path="url(#terminal-3882219697-line-13)">remove the generated files</text><text class="terminal-3882219697-r2" x="536.8" y="337.2" textLength="12.2" clip-path="url(#terminal-3882219697-line-13)">
|
||||
</text><text class="terminal-3882219697-r6" x="0" y="361.6" textLength="134.2" clip-path="url(#terminal-3882219697-line-14)">       info</text><text class="terminal-3882219697-r2" x="134.2" y="361.6" textLength="36.6" clip-path="url(#terminal-3882219697-line-14)"> │ </text><text class="terminal-3882219697-r7" x="170.8" y="361.6" textLength="329.4" clip-path="url(#terminal-3882219697-line-14)">demonstrate usage of tprint</text><text class="terminal-3882219697-r2" x="536.8" y="361.6" textLength="12.2" clip-path="url(#terminal-3882219697-line-14)">
|
||||
</text><text class="terminal-3882219697-r6" x="0" y="386" textLength="134.2" clip-path="url(#terminal-3882219697-line-15)">    h, help</text><text class="terminal-3882219697-r2" x="134.2" y="386" textLength="36.6" clip-path="url(#terminal-3882219697-line-15)"> │ </text><text class="terminal-3882219697-r7" x="170.8" y="386" textLength="170.8" clip-path="url(#terminal-3882219697-line-15)">show this help</text><text class="terminal-3882219697-r2" x="536.8" y="386" textLength="12.2" clip-path="url(#terminal-3882219697-line-15)">
|
||||
</text><text class="terminal-3882219697-r2" x="536.8" y="410.4" textLength="12.2" clip-path="url(#terminal-3882219697-line-16)">
|
||||
</text><text class="terminal-3882219697-r2" x="0" y="434.8" textLength="402.6" clip-path="url(#terminal-3882219697-line-17)">for more info: gh.dayl.in/task.mk</text><text class="terminal-3882219697-r2" x="536.8" y="434.8" textLength="12.2" clip-path="url(#terminal-3882219697-line-17)">
|
||||
</text>
|
||||
</g>
|
||||
</g>
|
||||
|
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 12 KiB |
166
docs/assets/help.svg
Normal file
166
docs/assets/help.svg
Normal file
|
@ -0,0 +1,166 @@
|
|||
<svg class="rich-terminal shadow" viewBox="0 0 720.3333333333334 716.7333333333333" xmlns="http://www.w3.org/2000/svg">
|
||||
<!-- Generated with Rich https://www.textualize.io -->
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: "Fira Code";
|
||||
src: local("FiraCode-Regular"),
|
||||
url("https://cdn.jsdelivr.net/gh/ryanoasis/nerd-fonts@2.1.0/patched-fonts/FiraCode/Regular/complete/Fira%20Code%20Regular%20Nerd%20Font%20Complete.ttf") format("truetype");
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "Fira Code";
|
||||
src: local("FiraCode-Bold"),
|
||||
url("https://cdn.jsdelivr.net/gh/ryanoasis/nerd-fonts@2.1.0/patched-fonts/FiraCode/Bold/complete/Fira%20Code%20Bold%20Nerd%20Font%20Complete.ttf") format("truetype");
|
||||
font-style: bold;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.terminal-1053897658-matrix {
|
||||
font-family: Fira Code, monospace;
|
||||
font-size: 20px;
|
||||
line-height: 24.4px;
|
||||
font-variant-east-asian: full-width;
|
||||
}
|
||||
|
||||
.terminal-1053897658-title {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
font-family: arial;
|
||||
}
|
||||
|
||||
.shadow {
|
||||
-webkit-filter: drop-shadow( 2px 5px 2px rgba(0, 0, 0, .7));
|
||||
filter: drop-shadow( 2px 5px 2px rgba(0, 0, 0, .7));
|
||||
}
|
||||
.terminal-1053897658-r1 { fill: #94e2d5;font-weight: bold }
|
||||
.terminal-1053897658-r2 { fill: #c6d0f5 }
|
||||
.terminal-1053897658-r3 { fill: #f5c2e7;font-weight: bold }
|
||||
.terminal-1053897658-r4 { fill: #c6d0f5;font-style: italic;;text-decoration: underline; }
|
||||
.terminal-1053897658-r5 { fill: #a6e3a1;font-weight: bold }
|
||||
.terminal-1053897658-r6 { fill: #f9e2af;font-weight: bold }
|
||||
.terminal-1053897658-r7 { fill: #8288a5 }
|
||||
.terminal-1053897658-r8 { fill: #f38ba8;font-weight: bold }
|
||||
</style>
|
||||
|
||||
<defs>
|
||||
<clipPath id="terminal-1053897658-clip-terminal">
|
||||
<rect x="0" y="0" width="682.1999999999999" height="633.4" />
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-0">
|
||||
<rect x="0" y="1.5" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-1">
|
||||
<rect x="0" y="25.9" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-2">
|
||||
<rect x="0" y="50.3" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-3">
|
||||
<rect x="0" y="74.7" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-4">
|
||||
<rect x="0" y="99.1" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-5">
|
||||
<rect x="0" y="123.5" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-6">
|
||||
<rect x="0" y="147.9" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-7">
|
||||
<rect x="0" y="172.3" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-8">
|
||||
<rect x="0" y="196.7" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-9">
|
||||
<rect x="0" y="221.1" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-10">
|
||||
<rect x="0" y="245.5" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-11">
|
||||
<rect x="0" y="269.9" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-12">
|
||||
<rect x="0" y="294.3" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-13">
|
||||
<rect x="0" y="318.7" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-14">
|
||||
<rect x="0" y="343.1" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-15">
|
||||
<rect x="0" y="367.5" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-16">
|
||||
<rect x="0" y="391.9" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-17">
|
||||
<rect x="0" y="416.3" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-18">
|
||||
<rect x="0" y="440.7" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-19">
|
||||
<rect x="0" y="465.1" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-20">
|
||||
<rect x="0" y="489.5" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-21">
|
||||
<rect x="0" y="513.9" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-22">
|
||||
<rect x="0" y="538.3" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-23">
|
||||
<rect x="0" y="562.7" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
<clipPath id="terminal-1053897658-line-24">
|
||||
<rect x="0" y="587.1" width="683.2" height="24.65"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
|
||||
<rect fill="#1e1e2e" stroke="rgba(255,255,255,0.35)" stroke-width="1" x="10.1667" y="1" width="700" height="682.4" rx="8"/><text class="terminal-1053897658-title" fill="#c6d0f5" text-anchor="middle" x="350" y="27">make help</text>
|
||||
<g transform="translate(32,22)">
|
||||
<circle cx="0" cy="0" r="7" fill="#ff5f57"/>
|
||||
<circle cx="22" cy="0" r="7" fill="#febc2e"/>
|
||||
<circle cx="44" cy="0" r="7" fill="#28c840"/>
|
||||
</g>
|
||||
|
||||
<g transform="translate(18.166666666666664, 41) scale(.95)" clip-path="url(#terminal-1053897658-clip-terminal)">
|
||||
|
||||
<g class="terminal-1053897658-matrix">
|
||||
<text class="terminal-1053897658-r1" x="0" y="20" textLength="73.2" clip-path="url(#terminal-1053897658-line-0)">usage:</text><text class="terminal-1053897658-r2" x="683.2" y="20" textLength="12.2" clip-path="url(#terminal-1053897658-line-0)">
|
||||
</text><text class="terminal-1053897658-r2" x="97.6" y="44.4" textLength="158.6" clip-path="url(#terminal-1053897658-line-1)">make <recipe></text><text class="terminal-1053897658-r2" x="683.2" y="44.4" textLength="12.2" clip-path="url(#terminal-1053897658-line-1)">
|
||||
</text><text class="terminal-1053897658-r2" x="683.2" y="68.8" textLength="12.2" clip-path="url(#terminal-1053897658-line-2)">
|
||||
</text><text class="terminal-1053897658-r2" x="0" y="93.2" textLength="146.4" clip-path="url(#terminal-1053897658-line-3)">  Turn your </text><text class="terminal-1053897658-r3" x="146.4" y="93.2" textLength="122" clip-path="url(#terminal-1053897658-line-3)">`Makefile`</text><text class="terminal-1053897658-r2" x="268.4" y="93.2" textLength="61" clip-path="url(#terminal-1053897658-line-3)"> into</text><text class="terminal-1053897658-r2" x="683.2" y="93.2" textLength="12.2" clip-path="url(#terminal-1053897658-line-3)">
|
||||
</text><text class="terminal-1053897658-r2" x="0" y="117.6" textLength="73.2" clip-path="url(#terminal-1053897658-line-4)">  the </text><text class="terminal-1053897658-r4" x="73.2" y="117.6" textLength="134.2" clip-path="url(#terminal-1053897658-line-4)">task runner</text><text class="terminal-1053897658-r2" x="207.4" y="117.6" textLength="231.8" clip-path="url(#terminal-1053897658-line-4)"> you always needed.</text><text class="terminal-1053897658-r2" x="683.2" y="117.6" textLength="12.2" clip-path="url(#terminal-1053897658-line-4)">
|
||||
</text><text class="terminal-1053897658-r2" x="0" y="142" textLength="378.2" clip-path="url(#terminal-1053897658-line-5)">  See the example output below.</text><text class="terminal-1053897658-r2" x="683.2" y="142" textLength="12.2" clip-path="url(#terminal-1053897658-line-5)">
|
||||
</text><text class="terminal-1053897658-r2" x="683.2" y="166.4" textLength="12.2" clip-path="url(#terminal-1053897658-line-6)">
|
||||
</text><text class="terminal-1053897658-r5" x="24.4" y="190.8" textLength="475.8" clip-path="url(#terminal-1053897658-line-7)">          task.mk development          </text><text class="terminal-1053897658-r2" x="683.2" y="190.8" textLength="12.2" clip-path="url(#terminal-1053897658-line-7)">
|
||||
</text><text class="terminal-1053897658-r2" x="0" y="215.2" textLength="536.8" clip-path="url(#terminal-1053897658-line-8)">  ──────────────────────────────────────────</text><text class="terminal-1053897658-r2" x="683.2" y="215.2" textLength="12.2" clip-path="url(#terminal-1053897658-line-8)">
|
||||
</text><text class="terminal-1053897658-r6" x="0" y="239.6" textLength="134.2" clip-path="url(#terminal-1053897658-line-9)">  bootstrap</text><text class="terminal-1053897658-r2" x="134.2" y="239.6" textLength="36.6" clip-path="url(#terminal-1053897658-line-9)"> │ </text><text class="terminal-1053897658-r7" x="170.8" y="239.6" textLength="366" clip-path="url(#terminal-1053897658-line-9)">generate local dev environment</text><text class="terminal-1053897658-r2" x="683.2" y="239.6" textLength="12.2" clip-path="url(#terminal-1053897658-line-9)">
|
||||
</text><text class="terminal-1053897658-r6" x="0" y="264" textLength="134.2" clip-path="url(#terminal-1053897658-line-10)">    l, lint</text><text class="terminal-1053897658-r2" x="134.2" y="264" textLength="36.6" clip-path="url(#terminal-1053897658-line-10)"> │ </text><text class="terminal-1053897658-r7" x="170.8" y="264" textLength="183" clip-path="url(#terminal-1053897658-line-10)">lint the python</text><text class="terminal-1053897658-r2" x="683.2" y="264" textLength="12.2" clip-path="url(#terminal-1053897658-line-10)">
|
||||
</text><text class="terminal-1053897658-r6" x="0" y="288.4" textLength="134.2" clip-path="url(#terminal-1053897658-line-11)">     assets</text><text class="terminal-1053897658-r2" x="134.2" y="288.4" textLength="36.6" clip-path="url(#terminal-1053897658-line-11)"> │ </text><text class="terminal-1053897658-r7" x="170.8" y="288.4" textLength="183" clip-path="url(#terminal-1053897658-line-11)">generate assets</text><text class="terminal-1053897658-r2" x="683.2" y="288.4" textLength="12.2" clip-path="url(#terminal-1053897658-line-11)">
|
||||
</text><text class="terminal-1053897658-r6" x="0" y="312.8" textLength="134.2" clip-path="url(#terminal-1053897658-line-12)">    release</text><text class="terminal-1053897658-r2" x="134.2" y="312.8" textLength="36.6" clip-path="url(#terminal-1053897658-line-12)"> │ </text><text class="terminal-1053897658-r7" x="170.8" y="312.8" textLength="366" clip-path="url(#terminal-1053897658-line-12)">release new version of task.mk</text><text class="terminal-1053897658-r2" x="683.2" y="312.8" textLength="12.2" clip-path="url(#terminal-1053897658-line-12)">
|
||||
</text><text class="terminal-1053897658-r6" x="0" y="337.2" textLength="134.2" clip-path="url(#terminal-1053897658-line-13)">   c, clean</text><text class="terminal-1053897658-r2" x="134.2" y="337.2" textLength="36.6" clip-path="url(#terminal-1053897658-line-13)"> │ </text><text class="terminal-1053897658-r7" x="170.8" y="337.2" textLength="317.2" clip-path="url(#terminal-1053897658-line-13)">remove the generated files</text><text class="terminal-1053897658-r2" x="683.2" y="337.2" textLength="12.2" clip-path="url(#terminal-1053897658-line-13)">
|
||||
</text><text class="terminal-1053897658-r2" x="0" y="361.6" textLength="536.8" clip-path="url(#terminal-1053897658-line-14)">  ──────────────────────────────────────────</text><text class="terminal-1053897658-r2" x="683.2" y="361.6" textLength="12.2" clip-path="url(#terminal-1053897658-line-14)">
|
||||
</text><text class="terminal-1053897658-r2" x="683.2" y="386" textLength="12.2" clip-path="url(#terminal-1053897658-line-15)">
|
||||
</text><text class="terminal-1053897658-r8" x="24.4" y="410.4" textLength="475.8" clip-path="url(#terminal-1053897658-line-16)">      examples of task.mk features     </text><text class="terminal-1053897658-r2" x="683.2" y="410.4" textLength="12.2" clip-path="url(#terminal-1053897658-line-16)">
|
||||
</text><text class="terminal-1053897658-r2" x="0" y="434.8" textLength="536.8" clip-path="url(#terminal-1053897658-line-17)">  ──────────────────────────────────────────</text><text class="terminal-1053897658-r2" x="683.2" y="434.8" textLength="12.2" clip-path="url(#terminal-1053897658-line-17)">
|
||||
</text><text class="terminal-1053897658-r6" x="0" y="459.2" textLength="134.2" clip-path="url(#terminal-1053897658-line-18)">     list-%</text><text class="terminal-1053897658-r2" x="134.2" y="459.2" textLength="36.6" clip-path="url(#terminal-1053897658-line-18)"> │ </text><text class="terminal-1053897658-r7" x="170.8" y="459.2" textLength="366" clip-path="url(#terminal-1053897658-line-18)">use pathlib.Path to list files</text><text class="terminal-1053897658-r2" x="683.2" y="459.2" textLength="12.2" clip-path="url(#terminal-1053897658-line-18)">
|
||||
</text><text class="terminal-1053897658-r7" x="170.8" y="483.6" textLength="512.4" clip-path="url(#terminal-1053897658-line-19)">name the directory in rule (make list-src)</text><text class="terminal-1053897658-r2" x="683.2" y="483.6" textLength="12.2" clip-path="url(#terminal-1053897658-line-19)">
|
||||
</text><text class="terminal-1053897658-r6" x="0" y="508" textLength="134.2" clip-path="url(#terminal-1053897658-line-20)">       info</text><text class="terminal-1053897658-r2" x="134.2" y="508" textLength="36.6" clip-path="url(#terminal-1053897658-line-20)"> │ </text><text class="terminal-1053897658-r7" x="170.8" y="508" textLength="329.4" clip-path="url(#terminal-1053897658-line-20)">demonstrate usage of tprint</text><text class="terminal-1053897658-r2" x="683.2" y="508" textLength="12.2" clip-path="url(#terminal-1053897658-line-20)">
|
||||
</text><text class="terminal-1053897658-r6" x="0" y="532.4" textLength="134.2" clip-path="url(#terminal-1053897658-line-21)">      check</text><text class="terminal-1053897658-r2" x="134.2" y="532.4" textLength="36.6" clip-path="url(#terminal-1053897658-line-21)"> │ </text><text class="terminal-1053897658-r7" x="170.8" y="532.4" textLength="353.8" clip-path="url(#terminal-1053897658-line-21)">get user confirmation or exit</text><text class="terminal-1053897658-r2" x="683.2" y="532.4" textLength="12.2" clip-path="url(#terminal-1053897658-line-21)">
|
||||
</text><text class="terminal-1053897658-r2" x="0" y="556.8" textLength="536.8" clip-path="url(#terminal-1053897658-line-22)">  ──────────────────────────────────────────</text><text class="terminal-1053897658-r2" x="683.2" y="556.8" textLength="12.2" clip-path="url(#terminal-1053897658-line-22)">
|
||||
</text><text class="terminal-1053897658-r6" x="0" y="581.2" textLength="134.2" clip-path="url(#terminal-1053897658-line-23)">    h, help</text><text class="terminal-1053897658-r2" x="134.2" y="581.2" textLength="36.6" clip-path="url(#terminal-1053897658-line-23)"> │ </text><text class="terminal-1053897658-r7" x="170.8" y="581.2" textLength="170.8" clip-path="url(#terminal-1053897658-line-23)">show this help</text><text class="terminal-1053897658-r2" x="683.2" y="581.2" textLength="12.2" clip-path="url(#terminal-1053897658-line-23)">
|
||||
</text><text class="terminal-1053897658-r2" x="683.2" y="605.6" textLength="12.2" clip-path="url(#terminal-1053897658-line-24)">
|
||||
</text><text class="terminal-1053897658-r2" x="0" y="630" textLength="561.2" clip-path="url(#terminal-1053897658-line-25)">for more info: github.com/daylinmorgan/task.mk</text><text class="terminal-1053897658-r2" x="683.2" y="630" textLength="12.2" clip-path="url(#terminal-1053897658-line-25)">
|
||||
</text>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 16 KiB |
1
docs/examples/.bashrc
Normal file
1
docs/examples/.bashrc
Normal file
|
@ -0,0 +1 @@
|
|||
export PS1='task.mk demo % '
|
18
docs/examples/Makefile
Normal file
18
docs/examples/Makefile
Normal file
|
@ -0,0 +1,18 @@
|
|||
MAKEFLAGS += --no-print-directory
|
||||
COLS ?= 60
|
||||
ROWS ?= 20
|
||||
EXAMPLES := check embedded
|
||||
CASTS := $(addsuffix /demo.cast, $(EXAMPLES))
|
||||
|
||||
all: $(CASTS)
|
||||
|
||||
%/demo.cast: %/record.sh
|
||||
asciinema rec --cols $(COLS) --rows $(ROWS) --overwrite -c $< $@
|
||||
|
||||
check/demo.cast: COLS = 45
|
||||
check/demo.cast: ROWS = 12
|
||||
|
||||
clean:
|
||||
rm -rf $(CASTS)
|
||||
|
||||
.PHONY:all clean
|
20
docs/examples/check/check.mk
Normal file
20
docs/examples/check/check.mk
Normal file
|
@ -0,0 +1,20 @@
|
|||
msgfmt = {a.style('==>','bold')} {a.style('$(1)','b_magenta')} {a.style('<==','bold')}
|
||||
msg = $(call tprint,$(call msgfmt ,$(1)))
|
||||
|
||||
|
||||
## check | get user confirmation or exit
|
||||
.PHONY: check
|
||||
check:
|
||||
$(call tconfirm,Would you like to proceed?)
|
||||
@echo "you said yes!"
|
||||
|
||||
define USAGE
|
||||
{a.$(HEADER_STYLE)}usage:{a.end}
|
||||
make <recipe>
|
||||
|
||||
interactivity w/ task.mk\n
|
||||
endef
|
||||
|
||||
.DEFUALT_GOAL = help
|
||||
include $(shell git rev-parse --show-toplevel)/task.mk
|
||||
|
130
docs/examples/check/demo.cast
Normal file
130
docs/examples/check/demo.cast
Normal file
|
@ -0,0 +1,130 @@
|
|||
{"version": 2, "width": 45, "height": 12, "timestamp": 1663509712, "env": {"SHELL": "/usr/bin/zsh", "TERM": "xterm-256color"}}
|
||||
[0.007004, "o", "\u001b[H\u001b[2J\u001b[3J"]
|
||||
[0.007499, "o", "bash >> "]
|
||||
[0.007695, "o", "m"]
|
||||
[0.188475, "o", "a"]
|
||||
[0.278605, "o", "k"]
|
||||
[0.368932, "o", "e"]
|
||||
[0.459055, "o", " -"]
|
||||
[0.549199, "o", "f"]
|
||||
[0.639392, "o", " "]
|
||||
[0.729414, "o", "c"]
|
||||
[0.81952, "o", "h"]
|
||||
[0.909732, "o", "ec"]
|
||||
[1.090009, "o", "k"]
|
||||
[1.180084, "o", "/"]
|
||||
[1.270256, "o", "c"]
|
||||
[1.360329, "o", "h"]
|
||||
[1.450517, "o", "ec"]
|
||||
[1.540604, "o", "k"]
|
||||
[1.630898, "o", "."]
|
||||
[1.72087, "o", "m"]
|
||||
[1.811036, "o", "k"]
|
||||
[1.991393, "o", " h"]
|
||||
[2.081431, "o", "e"]
|
||||
[2.171549, "o", "l"]
|
||||
[2.261684, "o", "p"]
|
||||
[2.351833, "o", "\r\n"]
|
||||
[3.373753, "o", "\u001b[1;36musage:\u001b[0m\r\n\tmake <recipe>\r\n\t\r\n\tinteractivity w/ task.mk\r\n\r\n\u001b[1;33m check\u001b[0m │ \u001b[2mget user confirmation or exit\u001b[0m\r\n\u001b[1;33m h, help\u001b[0m │ \u001b[2mshow this help\u001b[0m\r\n\r\n"]
|
||||
[5.378629, "o", "\u001b[H\u001b[2J\u001b[3J"]
|
||||
[5.37884, "o", "bash >> "]
|
||||
[5.380877, "o", "m"]
|
||||
[5.561187, "o", "a"]
|
||||
[5.651259, "o", "k"]
|
||||
[5.741367, "o", "e"]
|
||||
[5.83161, "o", " -"]
|
||||
[5.921765, "o", "f"]
|
||||
[6.011971, "o", " "]
|
||||
[6.102115, "o", "c"]
|
||||
[6.192388, "o", "h"]
|
||||
[6.282346, "o", "ec"]
|
||||
[6.462683, "o", "k"]
|
||||
[6.552812, "o", "/"]
|
||||
[6.642847, "o", "c"]
|
||||
[6.73297, "o", "h"]
|
||||
[6.823099, "o", "ec"]
|
||||
[6.913297, "o", "k"]
|
||||
[7.003515, "o", "."]
|
||||
[7.093594, "o", "m"]
|
||||
[7.183719, "o", "k"]
|
||||
[7.364474, "o", " c"]
|
||||
[7.454638, "o", "h"]
|
||||
[7.544856, "o", "e"]
|
||||
[7.634908, "o", "c"]
|
||||
[7.725037, "o", "k"]
|
||||
[7.815191, "o", "\r\n"]
|
||||
[8.827899, "o", "Would you like to proceed? \u001b[1;31m[Y/n]\u001b[0m "]
|
||||
[9.751154, "o", "y"]
|
||||
[9.837618, "o", "\r\n"]
|
||||
[9.846779, "o", "you said yes!\r\n"]
|
||||
[11.850338, "o", "#"]
|
||||
[12.030527, "o", " "]
|
||||
[12.12062, "o", "L"]
|
||||
[12.210763, "o", "e"]
|
||||
[12.300857, "o", "t'"]
|
||||
[12.391099, "o", "s"]
|
||||
[12.481244, "o", " "]
|
||||
[12.57145, "o", "t"]
|
||||
[12.66148, "o", "r"]
|
||||
[12.751606, "o", "y "]
|
||||
[12.932134, "o", "a"]
|
||||
[13.022101, "o", "g"]
|
||||
[13.112244, "o", "a"]
|
||||
[13.202336, "o", "i"]
|
||||
[13.292469, "o", "n "]
|
||||
[13.38261, "o", "b"]
|
||||
[13.472767, "o", "u"]
|
||||
[13.562841, "o", "t"]
|
||||
[13.652944, "o", " "]
|
||||
[13.833164, "o", "in"]
|
||||
[13.923274, "o", "s"]
|
||||
[14.013422, "o", "t"]
|
||||
[14.10364, "o", "e"]
|
||||
[14.193783, "o", "a"]
|
||||
[14.283859, "o", "d "]
|
||||
[14.374022, "o", "s"]
|
||||
[14.464304, "o", "a"]
|
||||
[14.554416, "o", "y"]
|
||||
[14.734528, "o", " "]
|
||||
[14.824636, "o", "no"]
|
||||
[14.914924, "o", " "]
|
||||
[15.005102, "o", "t"]
|
||||
[15.095117, "o", "h"]
|
||||
[15.185276, "o", "i"]
|
||||
[15.275414, "o", "s "]
|
||||
[15.365521, "o", "t"]
|
||||
[15.45574, "o", "i"]
|
||||
[15.635918, "o", "m"]
|
||||
[15.726033, "o", "e"]
|
||||
[15.816169, "o", "\r\n"]
|
||||
[16.817697, "o", "\u001b[H\u001b[2J\u001b[3J"]
|
||||
[16.817793, "o", "bash >> "]
|
||||
[16.818364, "o", "m"]
|
||||
[16.999104, "o", "a"]
|
||||
[17.089183, "o", "k"]
|
||||
[17.179376, "o", "e"]
|
||||
[17.269421, "o", " -"]
|
||||
[17.359516, "o", "f"]
|
||||
[17.449715, "o", " "]
|
||||
[17.539785, "o", "c"]
|
||||
[17.629954, "o", "h"]
|
||||
[17.720065, "o", "ec"]
|
||||
[17.900294, "o", "k"]
|
||||
[17.990472, "o", "/"]
|
||||
[18.080485, "o", "c"]
|
||||
[18.170674, "o", "h"]
|
||||
[18.260717, "o", "ec"]
|
||||
[18.350924, "o", "k"]
|
||||
[18.441115, "o", "."]
|
||||
[18.531291, "o", "m"]
|
||||
[18.621449, "o", "k"]
|
||||
[18.801717, "o", " c"]
|
||||
[18.891834, "o", "h"]
|
||||
[18.982112, "o", "e"]
|
||||
[19.07216, "o", "c"]
|
||||
[19.162471, "o", "k"]
|
||||
[19.252562, "o", "\r\n"]
|
||||
[20.265973, "o", "Would you like to proceed? \u001b[1;31m[Y/n]\u001b[0m "]
|
||||
[21.947847, "o", "n"]
|
||||
[22.001462, "o", "\r\n"]
|
||||
[22.00656, "o", "make[1]: *** [check/check.mk:8: check] Error 1\r\n"]
|
12
docs/examples/check/index.md
Normal file
12
docs/examples/check/index.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Check
|
||||
|
||||
<div id="demo"></div>
|
||||
<script src="/javascripts/asciinema-player.min.js"></script>
|
||||
<script async>
|
||||
AsciinemaPlayer.create('./demo.cast', document.getElementById('demo'),{loop:true});
|
||||
</script>
|
||||
|
||||
```make title="check.mk"
|
||||
--8<-- "docs/examples/check/check.mk"
|
||||
```
|
||||
|
10
docs/examples/check/record.sh
Executable file
10
docs/examples/check/record.sh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/../functions.sh"
|
||||
|
||||
cmd 'make -f check/check.mk help'
|
||||
cmd 'make -f check/check.mk check'
|
||||
msg "# Let's try again but instead say no this time"
|
||||
cmd 'make -f check/check.mk check'
|
||||
|
||||
|
125
docs/examples/embedded/demo.cast
Normal file
125
docs/examples/embedded/demo.cast
Normal file
|
@ -0,0 +1,125 @@
|
|||
{"version": 2, "width": 60, "height": 20, "timestamp": 1663509736, "env": {"SHELL": "/usr/bin/zsh", "TERM": "xterm-256color"}}
|
||||
[0.006995, "o", "\u001b[H\u001b[2J\u001b[3J"]
|
||||
[0.007356, "o", "bash >> "]
|
||||
[0.007626, "o", "m"]
|
||||
[0.188158, "o", "a"]
|
||||
[0.27839, "o", "k"]
|
||||
[0.368576, "o", "e"]
|
||||
[0.458807, "o", " -"]
|
||||
[0.548811, "o", "f"]
|
||||
[0.63903, "o", " "]
|
||||
[0.729091, "o", "e"]
|
||||
[0.819196, "o", "m"]
|
||||
[0.909274, "o", "be"]
|
||||
[1.089691, "o", "d"]
|
||||
[1.179663, "o", "d"]
|
||||
[1.269774, "o", "e"]
|
||||
[1.359973, "o", "d"]
|
||||
[1.450027, "o", "/e"]
|
||||
[1.540296, "o", "m"]
|
||||
[1.630272, "o", "b"]
|
||||
[1.720364, "o", "e"]
|
||||
[1.8106, "o", "d"]
|
||||
[1.990776, "o", "de"]
|
||||
[2.080964, "o", "d"]
|
||||
[2.17101, "o", "."]
|
||||
[2.261109, "o", "m"]
|
||||
[2.351249, "o", "k"]
|
||||
[2.441359, "o", " h"]
|
||||
[2.531512, "o", "e"]
|
||||
[2.621795, "o", "l"]
|
||||
[2.711889, "o", "p"]
|
||||
[2.892394, "o", "\r\n"]
|
||||
[3.915806, "o", "\u001b[1;36musage:\u001b[0m\r\n\tmake <recipe>\r\n\t\r\n\texamples of embedded scripts in `\u001b[35mMakefile\u001b[0m`\r\n\r\n \u001b[1;31m examples of task.mk features \u001b[0m\r\n\u001b[38m ─────────────────────────────────────────────────────\u001b[0m\r\n\u001b[1;33m list-%\u001b[0m │ \u001b[2muse pathlib.Path to list files\u001b[0m\r\n \u001b[2mname the directory in rule (make list-src)\u001b[0m\r\n\u001b[1;33m embedded-bash\u001b[0m │ \u001b[2mbash script with pipes and make input\u001b[0m\r\n\u001b[1;33m h, help\u001b[0m │ \u001b[2mshow this help\u001b[0m\r\n\r\n"]
|
||||
[5.921614, "o", "\u001b[H\u001b[2J\u001b[3J"]
|
||||
[5.921918, "o", "bash >> "]
|
||||
[5.923943, "o", "m"]
|
||||
[6.104382, "o", "a"]
|
||||
[6.194681, "o", "k"]
|
||||
[6.284819, "o", "e"]
|
||||
[6.375089, "o", " -"]
|
||||
[6.465174, "o", "f"]
|
||||
[6.555322, "o", " "]
|
||||
[6.64533, "o", "e"]
|
||||
[6.735435, "o", "m"]
|
||||
[6.825552, "o", "be"]
|
||||
[7.005939, "o", "d"]
|
||||
[7.096066, "o", "d"]
|
||||
[7.186097, "o", "e"]
|
||||
[7.276232, "o", "d"]
|
||||
[7.366364, "o", "/e"]
|
||||
[7.456527, "o", "m"]
|
||||
[7.546662, "o", "b"]
|
||||
[7.636777, "o", "e"]
|
||||
[7.726911, "o", "d"]
|
||||
[7.907171, "o", "de"]
|
||||
[7.99733, "o", "d"]
|
||||
[8.087458, "o", "."]
|
||||
[8.177539, "o", "m"]
|
||||
[8.26767, "o", "k"]
|
||||
[8.357795, "o", " l"]
|
||||
[8.447911, "o", "i"]
|
||||
[8.538022, "o", "s"]
|
||||
[8.628232, "o", "t"]
|
||||
[8.80841, "o", "-"]
|
||||
[8.898543, "o", "em"]
|
||||
[8.988721, "o", "b"]
|
||||
[9.078836, "o", "e"]
|
||||
[9.169069, "o", "d"]
|
||||
[9.259138, "o", "d"]
|
||||
[9.349222, "o", "ed"]
|
||||
[9.439533, "o", "\r\n"]
|
||||
[10.45661, "o", "files in embedded\r\n['embedded.mk', 'demo.cast', 'record.sh', 'index.md']\r\n"]
|
||||
[12.462317, "o", "\u001b[H\u001b[2J\u001b[3J"]
|
||||
[12.462399, "o", "bash >> "]
|
||||
[12.464413, "o", "m"]
|
||||
[12.644851, "o", "a"]
|
||||
[12.73513, "o", "k"]
|
||||
[12.825178, "o", "e"]
|
||||
[12.91541, "o", " -"]
|
||||
[13.005446, "o", "f"]
|
||||
[13.095515, "o", " "]
|
||||
[13.185598, "o", "e"]
|
||||
[13.275797, "o", "m"]
|
||||
[13.365927, "o", "be"]
|
||||
[13.54612, "o", "d"]
|
||||
[13.636273, "o", "d"]
|
||||
[13.726372, "o", "e"]
|
||||
[13.81653, "o", "d"]
|
||||
[13.906755, "o", "/e"]
|
||||
[13.996972, "o", "m"]
|
||||
[14.08711, "o", "b"]
|
||||
[14.177238, "o", "e"]
|
||||
[14.267423, "o", "d"]
|
||||
[14.447699, "o", "de"]
|
||||
[14.537782, "o", "d"]
|
||||
[14.627908, "o", "."]
|
||||
[14.718053, "o", "m"]
|
||||
[14.808215, "o", "k"]
|
||||
[14.898357, "o", " e"]
|
||||
[14.988612, "o", "m"]
|
||||
[15.078745, "o", "b"]
|
||||
[15.168911, "o", "e"]
|
||||
[15.349036, "o", "d"]
|
||||
[15.439167, "o", "de"]
|
||||
[15.529412, "o", "d"]
|
||||
[15.619518, "o", "-"]
|
||||
[15.709569, "o", "b"]
|
||||
[15.79969, "o", "a"]
|
||||
[15.889938, "o", "sh"]
|
||||
[15.980073, "o", "\r\n"]
|
||||
[16.989864, "o", "Is the process running bash? We can check with ps\r\n"]
|
||||
[16.999039, "o", "bash\r\n"]
|
||||
[16.999517, "o", "What text to figlet? \r\n"]
|
||||
[19.167405, "o", "t"]
|
||||
[19.201071, "o", "a"]
|
||||
[19.292173, "o", "s"]
|
||||
[19.436959, "o", "k"]
|
||||
[19.588588, "o", "."]
|
||||
[19.767086, "o", "m"]
|
||||
[19.903321, "o", "k"]
|
||||
[20.073296, "o", "\r\n"]
|
||||
[20.074356, "o", " _ _ _ \r\n| |_ __ _ ___| | __ _ __ ___ | | __\r\n| __/ _` / __| |/ / | '_ ` _ \\| |/ /\r\n| || (_| \\__ \\ < _| | | | | | < \r\n \\__\\__,_|___/_|\\_(_)_| |_| |_|_|\\_\\\r\n \r\n"]
|
||||
[20.074497, "o", "the argument below as given in the makefile itself\r\n"]
|
||||
[20.074527, "o", "it's expanded before the script is passed to bash\r\n"]
|
||||
[20.074555, "o", "bash multiline is probably working\r\n"]
|
54
docs/examples/embedded/embedded.mk
Normal file
54
docs/examples/embedded/embedded.mk
Normal file
|
@ -0,0 +1,54 @@
|
|||
msgfmt = {a.style('==>','bold')} {a.style('$(1)','b_magenta')} {a.style('<==','bold')}
|
||||
msg = $(call tprint,$(call msgfmt ,$(1)))
|
||||
|
||||
### examples of task.mk features | args: --divider --align center --msg-style b_red
|
||||
define list_files_py
|
||||
from pathlib import Path
|
||||
print("files in $(2)")
|
||||
print([f.name for f in (Path("$(2)").iterdir())])
|
||||
endef
|
||||
|
||||
## list-% | use pathlib.Path to list files
|
||||
### name the directory in rule (make list-src) | args: --align sep
|
||||
list-%:
|
||||
$(call py,list_files_py,$*)
|
||||
|
||||
# dollar signs will always be a problem
|
||||
define bash_script
|
||||
echo "Is the process running bash? We can check with ps"
|
||||
ps -o args= -p $$$$ | grep -E -m 1 -o '\w{0,5}sh'
|
||||
if [ -x "$(command -v figlet)" ]; then
|
||||
echo 'no figlet :('
|
||||
else
|
||||
echo "What text to figlet? "
|
||||
read name
|
||||
figlet $$name
|
||||
fi
|
||||
echo "the argument below as given in the makefile itself"
|
||||
echo "it's expanded before the script is passed to bash"
|
||||
printf "%s\n" "$(2)"
|
||||
endef
|
||||
|
||||
## embedded-bash | bash script with pipes and make input
|
||||
.PHONY: embedded-bash
|
||||
embedded-bash:
|
||||
$(call tbash,bash_script,bash multiline is probably working)
|
||||
|
||||
define mlmsg
|
||||
{a.b_yellow}
|
||||
It can even be multiline!{a.end}
|
||||
{a.style('and styles can be defined','red')}
|
||||
as python {a.bold}f-string{a.end} literals
|
||||
{a.end}
|
||||
endef
|
||||
|
||||
define USAGE
|
||||
{a.$(HEADER_STYLE)}usage:{a.end}
|
||||
make <recipe>
|
||||
|
||||
examples of embedded scripts in `{a.magenta}Makefile{a.end}`
|
||||
|
||||
endef
|
||||
.DEFUALT_GOAL = help
|
||||
include $(shell git rev-parse --show-toplevel)/task.mk
|
||||
|
12
docs/examples/embedded/index.md
Normal file
12
docs/examples/embedded/index.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Embedded
|
||||
|
||||
<div id="demo"></div>
|
||||
<script src="/javascripts/asciinema-player.min.js"></script>
|
||||
<script async>
|
||||
AsciinemaPlayer.create('./demo.cast', document.getElementById('demo'),{loop: true});
|
||||
</script>
|
||||
|
||||
```make title="embedded.mk"
|
||||
--8<-- "docs/examples/embedded/embedded.mk"
|
||||
```
|
||||
|
7
docs/examples/embedded/record.sh
Executable file
7
docs/examples/embedded/record.sh
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/../functions.sh"
|
||||
|
||||
cmd 'make -f embedded/embedded.mk help'
|
||||
cmd 'make -f embedded/embedded.mk list-embedded'
|
||||
cmd 'make -f embedded/embedded.mk embedded-bash'
|
15
docs/examples/functions.sh
Executable file
15
docs/examples/functions.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
msg() {
|
||||
printf '%s\n' "$1" | pv -qL 12
|
||||
sleep 1
|
||||
}
|
||||
|
||||
cmd (){
|
||||
clear
|
||||
printf 'bash >> '
|
||||
msg "$1"
|
||||
$1
|
||||
sleep 2
|
||||
}
|
||||
|
10
docs/examples/index.md
Normal file
10
docs/examples/index.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
# Examples
|
||||
|
||||
|
||||
[`Check`](./check)
|
||||
|
||||
: Perform a basic confirmation test with the user and exit with error code 1 if input is N/n.
|
||||
|
||||
[`Embedded`](./embedded)
|
||||
|
||||
: Use the builtin functions to write multi-line python/bash scripts directly in your `Makefile`
|
89
docs/index.md
Normal file
89
docs/index.md
Normal file
|
@ -0,0 +1,89 @@
|
|||
<div align="center">
|
||||
<h1 align="center"> task.mk </h1>
|
||||
<img src="https://raw.githubusercontent.com/daylinmorgan/task.mk/main/assets/help.svg" alt="help" width=400 >
|
||||
<p align="center">
|
||||
the task runner for GNU Make you've been missing
|
||||
</p>
|
||||
</div>
|
||||
</br>
|
||||
|
||||
GNU make is an excellent build tool and the task runner we love to hate, but can't escape.
|
||||
So let's improve the UX to make it the best task runner it can be.
|
||||
|
||||
`Task.mk`, is a standalone `Makefile` you can deploy alongside your own
|
||||
to add some QOL improvements for your users and fellow maintainers.
|
||||
|
||||
Current Features:
|
||||
|
||||
- ANSI escape code support (including NO\_COLOR)
|
||||
- formatted help output
|
||||
- custom print function
|
||||
- confirmation prompt
|
||||
|
||||
Depends on `GNU Make`, obviously and `Python >=3.7`.
|
||||
|
||||
Wait python?!?!, I'm not `pip` installing some package just to parse my makefile.
|
||||
I agree, all you need is one file [`.task.mk`](https://github.com/daylinmorgan/task.mk/blob/main/task.mk).
|
||||
You can automagically include it with just two additional lines to your `Makefile` (and probably one to your `.gitignore`) and your good to go.
|
||||
|
||||
## Setup
|
||||
|
||||
You can include this as an optional dependency on your project by adding the below lines to the end of your `Makefile`.
|
||||
If someone tries to invoke `make help` it will download `.task.mk` for them.
|
||||
|
||||
```make
|
||||
-include .task.mk
|
||||
$(if $(filter help,$(MAKECMDGOALS)),$(if $(wildcard .task.mk),,.task.mk: ; curl -fsSL https://raw.githubusercontent.com/daylinmorgan/task.mk/v22.9.14/task.mk -o .task.mk))
|
||||
```
|
||||
|
||||
You might also consider making it a consistently downloaded dependency if you plan to use any of it's advanced feature set, by dropping the `$(MAKECMDGOALS)` check.
|
||||
|
||||
```make
|
||||
-include .task.mk
|
||||
$(if $(wildcard .task.mk),,.task.mk: ; curl -fsSL https://raw.githubusercontent.com/daylinmorgan/task.mk/v22.9.14/task.mk -o .task.mk)
|
||||
```
|
||||
|
||||
Alternatively, you can use the builtin rule `_update-task.mk` to update to the latest development version.
|
||||
|
||||
See [Usage](./usage) to get started running all your tasks.
|
||||
See [Examples](./examples) for more use cases.
|
||||
|
||||
## Zsh Completions for GNU Make
|
||||
|
||||
If you use `GNU Make` with zsh you may want to add the following
|
||||
line to your rc file to allow `make` to handle the autocomplete.
|
||||
|
||||
```zsh
|
||||
zstyle ':completion::complete:make:*:targets' call-command true
|
||||
```
|
||||
|
||||
## Why Make?
|
||||
|
||||
There are lot of `GNU Make` alternatives but none have near the same level of ubiquity.
|
||||
This project attaches to `make` some of the native features of [`just`](https://github.com/casey/just), a command runner.
|
||||
|
||||
Just is a great task runner, but it suffers two problems, users probably don't have it installed already, and there is no way to define file specific recipes.
|
||||
Most of my `Makefile`'s are comprised primarily of handy `.PHONY` recipes, but I always end up with a few file specific recipes.
|
||||
|
||||
Another interesting project I've evaluated for these purposes is [`go-task/task`](https://github.com/go-task/task).
|
||||
`Task` has many of the features of `GNU Make` and some novel features of it's own.
|
||||
But like `just` it's a tool people don't usually already have and it's configured using a `yaml` file.
|
||||
`Yaml` files can be finicky to work with and and it uses a golang based shell runtime, not your native shell, which might lead to unexpected behavior.
|
||||
|
||||
|
||||
## Simpler Alternative
|
||||
|
||||
But I just want a basic help output, surely I don't need python for this... you would be right.
|
||||
`Task.mk` replaces my old `make help` recipe boilerplate which may better serve you (so long as you have `sed`/`awk`).
|
||||
|
||||
|
||||
```make
|
||||
## h, help | show this help
|
||||
.PHONY: help h
|
||||
help h: Makefile
|
||||
@awk -v fill=$(shell sed -n 's/^## \(.*\) | .*/\1/p' $< | wc -L)\
|
||||
'match($$0,/^## (.*) \|/,name) && match($$0,/\| (.*)$$/,help)\
|
||||
{printf "\033[1;93m%*s\033[0m | \033[30m%s\033[0m\n",\
|
||||
fill,name[1],help[1];} match($$0,/^### (.*)/,str) \
|
||||
{printf "%*s \033[30m%s\033[0m\n",fill," ",str[1];}' $<
|
||||
```
|
1
docs/javascripts/asciinema-player.min.js
vendored
Normal file
1
docs/javascripts/asciinema-player.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2508
docs/stylesheets/asciinema-player.css
Normal file
2508
docs/stylesheets/asciinema-player.css
Normal file
File diff suppressed because it is too large
Load diff
107
docs/stylesheets/extra.css
Normal file
107
docs/stylesheets/extra.css
Normal file
|
@ -0,0 +1,107 @@
|
|||
:root {
|
||||
--ctp-latte-rosewater: #de9584;
|
||||
--ctp-mocha-rosewater: #f5e0dc;
|
||||
--ctp-latte-flamingo: #dd7878;
|
||||
--ctp-mocha-flamingo: #f2cdcd;
|
||||
--ctp-latte-pink: #ec83d0;
|
||||
--ctp-mocha-pink: #f5c2e7;
|
||||
--ctp-latte-mauve: #8839ef;
|
||||
--ctp-mocha-mauve: #cba6f7;
|
||||
--ctp-latte-red: #d20f39;
|
||||
--ctp-mocha-red: #f38ba8;
|
||||
--ctp-latte-maroon: #e64553;
|
||||
--ctp-mocha-maroon: #eba0ac;
|
||||
--ctp-latte-peach: #fe640b;
|
||||
--ctp-mocha-peach: #fab387;
|
||||
--ctp-latte-yellow: #e49320;
|
||||
--ctp-mocha-yellow: #f9e2af;
|
||||
--ctp-latte-green: #40a02b;
|
||||
--ctp-mocha-green: #a6e3a1;
|
||||
--ctp-latte-teal: #179299;
|
||||
--ctp-mocha-teal: #94e2d5;
|
||||
--ctp-latte-sky: #04a5e5;
|
||||
--ctp-mocha-sky: #89dceb;
|
||||
--ctp-latte-sapphire: #209fb5;
|
||||
--ctp-mocha-sapphire: #74c7ec;
|
||||
--ctp-latte-blue: #2a6ef5;
|
||||
--ctp-mocha-blue: #87b0f9;
|
||||
--ctp-latte-lavender: #7287fd;
|
||||
--ctp-mocha-lavender: #b4befe;
|
||||
--ctp-latte-text: #4c4f69;
|
||||
--ctp-mocha-text: #c6d0f5;
|
||||
--ctp-latte-subtext1: #5c5f77;
|
||||
--ctp-mocha-subtext1: #b3bcdf;
|
||||
--ctp-latte-subtext0: #6c6f85;
|
||||
--ctp-mocha-subtext0: #a1a8c9;
|
||||
--ctp-latte-overlay2: #7c7f93;
|
||||
--ctp-mocha-overlay2: #8e95b3;
|
||||
--ctp-latte-overlay1: #8c8fa1;
|
||||
--ctp-mocha-overlay1: #7b819d;
|
||||
--ctp-latte-overlay0: #9ca0b0;
|
||||
--ctp-mocha-overlay0: #696d86;
|
||||
--ctp-latte-surface2: #acb0be;
|
||||
--ctp-mocha-surface2: #565970;
|
||||
--ctp-latte-surface1: #bcc0cc;
|
||||
--ctp-mocha-surface1: #43465a;
|
||||
--ctp-latte-surface0: #ccd0da;
|
||||
--ctp-mocha-surface0: #313244;
|
||||
--ctp-latte-base: #eff1f5;
|
||||
--ctp-mocha-base: #1e1e2e;
|
||||
--ctp-latte-mantle: #e6e9ef;
|
||||
--ctp-mocha-mantle: #181825;
|
||||
--ctp-latte-crust: #dce0e8;
|
||||
--ctp-mocha-crust: #11111b;
|
||||
}
|
||||
:root > * {
|
||||
--md-default-fg-color: var(--ctp-mocha-text);
|
||||
--md-default-fg-color--light: var(--md-default-fg-color);
|
||||
--md-default-fg-color--lighter: var(--md-default-fg-color);
|
||||
--md-default-fg-color--lightest: var(--ctp-mocha-surface2);
|
||||
|
||||
--md-default-bg-color: var(--ctp-mocha-base);
|
||||
--md-default-bg-color--light: var(--md-default-bg-color);
|
||||
--md-default-bg-color--lighter: var(--md-default-bg-color);
|
||||
--md-default-bg-color--lightest: var(--md-default-bg-color);
|
||||
|
||||
--md-primary-fg-color: var(--ctp-mocha-rosewater);
|
||||
--md-primary-bg-color: var(--ctp-mocha-base);
|
||||
--md-primary-fg-color--light:var(--md-primary-fg-color)
|
||||
--md-primary-fg-color--dark: var(--md-primary-fg-color);
|
||||
--md-primary-bg-color--light: var(--md-primary-bg-color);
|
||||
--md-primary-fg-color--dark: var(--md-primary-bg-color);
|
||||
|
||||
--md-accent-fg-color:var(--ctp-mocha-crust);
|
||||
--md-accent-bg-color:var(--ctp-mocha-surface2);
|
||||
/* --md-accent-fg-color--transparent: var(--ctp-mocha-teal); */
|
||||
|
||||
--md-code-fg-color:var(--ctp-mocha-text);
|
||||
--md-code-bg-color:var(--ctp-mocha-surface0);
|
||||
|
||||
--md-footer-fg-color:var(--ctp-mocha-text);
|
||||
--md-footer-fg-color--light: var(--md-footer-fg-color);
|
||||
--md-footer-fg-color--lighter: var(--md-footer-fg-color);
|
||||
--md-footer-bg-color:var(--ctp-mocha-crust);
|
||||
--md-footer-bg-color--dark: var(--ctp-mocha-crust);
|
||||
|
||||
--md-code-fg-color:var(--ctp-mocha-text);
|
||||
--md-code-bg-color:var(--ctp-mocha-mantle);
|
||||
--md-code-hl-color: var(--ctp-mocha-yellow);
|
||||
--md-code-hl-number-color: var(--ctp-mocha-red);
|
||||
--md-code-hl-function-color: var(--ctp-mocha-blue);
|
||||
--md-code-hl-constant-color: var(--ctp-mocha-peach);
|
||||
--md-code-hl-special-color: var(--ctp-mocha-rosewater);
|
||||
--md-code-hl-keyword-color: var(--ctp-mocha-sapphire);
|
||||
--md-code-hl-string-color:var(--ctp-mocha-green);
|
||||
|
||||
--md-typeset-mark-color: var(--ctp-mocha-lavendar);
|
||||
--md-typeset-del-color: var(--ctp-mocha-red);
|
||||
--md-typeset-ins-color: var(--ctp-mocha-green);
|
||||
|
||||
--md-typeset-table-color: var(--ctp-mocha-crust);
|
||||
}
|
||||
|
||||
/* // Typeset `kbd` color shades */
|
||||
/* --md-typeset-kbd-color: hsla(0, 0%, 98%, 1); */
|
||||
/* --md-typeset-kbd-accent-color: hsla(0, 100%, 100%, 1); */
|
||||
/* --md-typeset-kbd-border-color: hsla(0, 0%, 72%, 1); */
|
||||
|
120
docs/usage.md
Normal file
120
docs/usage.md
Normal file
|
@ -0,0 +1,120 @@
|
|||
# Usage
|
||||
|
||||
`Task.mk` will add access to a recipe `help` (also aliased to `h`).
|
||||
In order to use `make help` to you will need to add some custom comments to your `Makefile`.
|
||||
|
||||
Deliberately, I don't get names from recipes themselves.
|
||||
This not only greatly simplifies the parsing but add's some opportunity to customize the output.
|
||||
Such as to document wildcard or redundant recipes.
|
||||
|
||||
You can place these anywhere, but I recommend adding these notes directly above their relevant recipes.
|
||||
The format is `## <recipe> | <msg>`
|
||||
|
||||
```make
|
||||
## build | build the project
|
||||
.PHONY: build
|
||||
build:
|
||||
...
|
||||
```
|
||||
|
||||
Now when you invoke `make help` it will parse these and generate your help output.
|
||||
|
||||
In addition to a generic help output you can expose some configuration settings with `make vars`.
|
||||
To do so define the variables you'd like to print with `PRINT_VARS := VAR1 VAR2 VAR3`.
|
||||
|
||||
In addition to the `help` and `vars` recipes you can use a custom make function to format your text for fancier output.
|
||||
For this there are two options depending on your needs `tprint` or `tprint-sh`. (`tprint-sh` is for use within a multiline sub-shell that has already been silenced, see the version-check rule of this project's `Makefile` for an example.)
|
||||
|
||||
|
||||
To use `tprint` you call it with the builtin `make` call function.
|
||||
It accepts only one argument: an unquoted f-string literal.
|
||||
All strings passed to `tprint` have access to an object `ansi` or `a` for simplicity.
|
||||
This stores ANSI escape codes which can be used to style your text.
|
||||
|
||||
```make
|
||||
## build | compile the source
|
||||
.PHONY: build
|
||||
build:
|
||||
$(call tprint,{a.cyan}Build Starting{a.end})
|
||||
...
|
||||
$(call tprint,{a.green}Build Finished{a.end})
|
||||
```
|
||||
See this projects `make info` for more examples of `tprint`.
|
||||
|
||||
To see the available colors and formatting(bold,italic,etc.) use the hidden recipe `make _print-ansi`.
|
||||
|
||||
**Note**: Any help commands starting with an underscore will be ignored.
|
||||
To view hidden `tasks` (or recipes in GNU Make land) you can use `make _help`.
|
||||
|
||||
In addition, you can use custom colors using the builtin `ansi.custom` or (`a.custom`) method.
|
||||
It has two optional arguments `fg` and `bg`. Which can be used to specify either an 8-bit color from the [256 colors](https://en.wikipedia.org/wiki/8-bit_color).
|
||||
Or a tuple/list to define an RBG 24-bit color, for instance `a.custom(fg=(5,10,255))`.
|
||||
See this project's `make info` for an example.
|
||||
|
||||
## Configuration
|
||||
|
||||
You can quickly customize some of the default behavior of `task.mk` by overriding the below variables prior to the `-include .task.mk`.
|
||||
|
||||
```make
|
||||
# ---- CONFIG ---- #
|
||||
HEADER_STYLE ?= b_cyan
|
||||
PARAMS_STYLE ?= b_magenta
|
||||
ACCENT_STYLE ?= b_yellow
|
||||
GOAL_STYLE ?= $(ACCENT_STYLE)
|
||||
MSG_STYLE ?= faint
|
||||
DIVIDER_STYLE ?= default
|
||||
DIVIDER ?= ─
|
||||
HELP_SEP ?= │
|
||||
|
||||
# python f-string literals
|
||||
EPILOG ?=
|
||||
define USAGE ?=
|
||||
{ansi.$(HEADER_STYLE)}usage{ansi.end}:
|
||||
make <recipe>
|
||||
|
||||
endef
|
||||
```
|
||||
|
||||
To use a custom color for one of the predefined configuration variables specify only the custom method.
|
||||
|
||||
```make
|
||||
HEADER_STYLE = custom(fg=171,bg=227)
|
||||
```
|
||||
|
||||
**NOTE**: `HELP_SEP` does not change the argument definitions syntax only the format of `make help`.
|
||||
|
||||
## Advanced Usage: Embedded Python Scripts
|
||||
|
||||
You can take advantage of the builtin python script runner and write multi-line python scripts of your own.
|
||||
This is a simple example but a few lines of python in your `Makefile`
|
||||
may be easier than balancing sub-shells and strung together awk commands.
|
||||
|
||||
When `make` expands the function it will take the parameters passed to `py` and expand them.
|
||||
`$(1)` is the variable name and `$(2)` in this case is the implicit pattern from the rule. Pay attention to quotes.
|
||||
If you need to debug your python script, use `DEBUG=1` when you run `make` and it will first print the script that will be piped to `python`.
|
||||
|
||||
```make
|
||||
define list_files_py
|
||||
from pathlib import Path
|
||||
print("files in $(2)")
|
||||
print([f.name for f in (Path("$(2)").iterdir())])
|
||||
endef
|
||||
|
||||
## list-% | use pathlib.Path to list files
|
||||
list-%:
|
||||
$(call py,list_files_py,$*)
|
||||
```
|
||||
|
||||
For what it's worth there is also a predefined function for `bash` (named `tbash`) as well should you need to accomplish something similar of more easily embedding your bash script rather than having to escape every line with a backslash.
|
||||
|
||||
```make
|
||||
define bash_script
|
||||
figlet task.mk 2>/dev/null || echo 'no figlet :('
|
||||
echo "This is from bash"
|
||||
cat /etc/hostname
|
||||
printf "%s\n" "$(2)"
|
||||
endef
|
||||
.PHONY: test-bash
|
||||
test-bash:
|
||||
$(call tbash,bash_script,test bash multiline)
|
||||
```
|
28
mkdocs.yml
Normal file
28
mkdocs.yml
Normal file
|
@ -0,0 +1,28 @@
|
|||
site_name: task.mk
|
||||
site_url: https://gh.dayl.in/task.mk
|
||||
repo_url: https://github.com/daylinmorgan/task.mk
|
||||
repo_name: daylinmorgan/task.mk
|
||||
theme:
|
||||
name: material
|
||||
features:
|
||||
- navigation.indexes
|
||||
palette:
|
||||
- scheme: default
|
||||
extra_css:
|
||||
- stylesheets/extra.css
|
||||
- stylesheets/asciinema-player.css
|
||||
# extra_javascript:
|
||||
# - javascripts/asciinema-player.min.js
|
||||
plugins:
|
||||
- search
|
||||
- git-revision-date-localized:
|
||||
enable_creation_date: true
|
||||
markdown_extensions:
|
||||
- def_list
|
||||
- pymdownx.highlight:
|
||||
anchor_linenums: true
|
||||
- pymdownx.inlinehilite
|
||||
- pymdownx.snippets
|
||||
- pymdownx.superfences
|
||||
|
||||
|
2
task.mk
2
task.mk
|
@ -1,7 +1,7 @@
|
|||
# }> [github.com/daylinmorgan/task.mk] <{ #
|
||||
# Copyright (c) 2022 Daylin Morgan
|
||||
# MIT License
|
||||
# version: v22.9.14-13-gd2a239d-dev
|
||||
# version: v22.9.14-18-g1a018e2-dev
|
||||
#
|
||||
# task.mk should be included at the bottom of your Makefile with `-include .task.mk`
|
||||
# See below for the standard configuration options that should be set prior to including this file.
|
||||
|
|
Loading…
Reference in a new issue