mirror of
https://github.com/daylinmorgan/task.mk.git
synced 2024-12-22 01:50:44 -06:00
Compare commits
6 commits
47c686a7ba
...
8a53f0d14c
Author | SHA1 | Date | |
---|---|---|---|
|
8a53f0d14c | ||
|
8e754cf4c4 | ||
|
83fdd0a42c | ||
|
47eb5e13f0 | ||
|
822280b9c5 | ||
|
627c4fd122 |
12 changed files with 163 additions and 113 deletions
9
404.html
9
404.html
|
@ -441,8 +441,17 @@
|
|||
<script id="__config" type="application/json">{"base": "/task.mk/", "features": ["navigation.indexes"], "search": "/task.mk/assets/javascripts/workers/search.ecf98df9.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version.title": "Select version"}}</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="/task.mk/assets/javascripts/bundle.39f04ddb.min.js"></script>
|
||||
|
||||
<script src="/task.mk/javascripts/asciinema-player.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,7 +1,3 @@
|
|||
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:
|
||||
|
|
|
@ -420,38 +420,30 @@
|
|||
|
||||
|
||||
|
||||
<a href="https://github.com/daylinmorgan/task.mk/edit/master/docs/examples/check/index.md" title="Edit this page" class="md-content__button md-icon">
|
||||
<a href="https://github.com/daylinmorgan/task.mk/edit/main/docs/examples/check/index.md" title="Edit this page" class="md-content__button md-icon">
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25Z"/></svg>
|
||||
</a>
|
||||
|
||||
|
||||
<h1 id="check">Check</h1>
|
||||
<div id="demo"></div>
|
||||
<script src="/javascripts/asciinema-player.min.js"></script>
|
||||
<script async>
|
||||
AsciinemaPlayer.create('./demo.cast', document.getElementById('demo'),{loop:true});
|
||||
</script>
|
||||
<div id="demo-cast"></div>
|
||||
|
||||
<div class="highlight"><span class="filename">check.mk</span><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nv">msgfmt</span> <span class="o">=</span> <span class="o">{</span>a.style<span class="o">(</span><span class="s1">'==>'</span>,<span class="s1">'bold'</span><span class="o">)}</span> <span class="o">{</span>a.style<span class="o">(</span><span class="s1">'$(1)'</span>,<span class="s1">'b_magenta'</span><span class="o">)}</span> <span class="o">{</span>a.style<span class="o">(</span><span class="s1">'<=='</span>,<span class="s1">'bold'</span><span class="o">)}</span>
|
||||
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a><span class="nv">msg</span> <span class="o">=</span> <span class="k">$(</span>call tprint,<span class="k">$(</span>call msgfmt ,<span class="k">$(</span><span class="m">1</span><span class="k">)))</span>
|
||||
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a>
|
||||
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a>
|
||||
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a><span class="c">## check | get user confirmation or exit</span>
|
||||
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a><span class="nf">.PHONY</span><span class="o">:</span> <span class="n">check</span>
|
||||
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a><span class="nf">check</span><span class="o">:</span>
|
||||
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a> <span class="k">$(</span>call tconfirm,Would you like to proceed?<span class="k">)</span>
|
||||
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a> @echo <span class="s2">"you said yes!"</span>
|
||||
<div class="highlight"><span class="filename">check.mk</span><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="c">## check | get user confirmation or exit</span>
|
||||
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a><span class="nf">.PHONY</span><span class="o">:</span> <span class="n">check</span>
|
||||
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a><span class="nf">check</span><span class="o">:</span>
|
||||
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="k">$(</span>call tconfirm,Would you like to proceed?<span class="k">)</span>
|
||||
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> @echo <span class="s2">"you said yes!"</span>
|
||||
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a>
|
||||
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a><span class="cp">define USAGE</span>
|
||||
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a><span class="nf">{a.$(HEADER_STYLE)}usage</span><span class="o">:</span>{<span class="n">a</span>.<span class="n">end</span>}
|
||||
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a> make <recipe>
|
||||
<a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a>
|
||||
<a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a><span class="cp">define USAGE</span>
|
||||
<a id="__codelineno-0-12" name="__codelineno-0-12" href="#__codelineno-0-12"></a><span class="nf">{a.$(HEADER_STYLE)}usage</span><span class="o">:</span>{<span class="n">a</span>.<span class="n">end</span>}
|
||||
<a id="__codelineno-0-13" name="__codelineno-0-13" href="#__codelineno-0-13"></a> make <recipe>
|
||||
<a id="__codelineno-0-14" name="__codelineno-0-14" href="#__codelineno-0-14"></a>
|
||||
<a id="__codelineno-0-15" name="__codelineno-0-15" href="#__codelineno-0-15"></a> interactivity w/ task.mk<span class="se">\n</span>
|
||||
<a id="__codelineno-0-16" name="__codelineno-0-16" href="#__codelineno-0-16"></a><span class="cp">endef</span>
|
||||
<a id="__codelineno-0-17" name="__codelineno-0-17" href="#__codelineno-0-17"></a>
|
||||
<a id="__codelineno-0-18" name="__codelineno-0-18" href="#__codelineno-0-18"></a><span class="nv">.DEFUALT_GOAL</span> <span class="o">=</span> <span class="nb">help</span>
|
||||
<a id="__codelineno-0-19" name="__codelineno-0-19" href="#__codelineno-0-19"></a><span class="cp">include $(shell git rev-parse --show-toplevel)/task.mk</span>
|
||||
<a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a> interactivity w/ task.mk<span class="se">\n</span>
|
||||
<a id="__codelineno-0-12" name="__codelineno-0-12" href="#__codelineno-0-12"></a><span class="cp">endef</span>
|
||||
<a id="__codelineno-0-13" name="__codelineno-0-13" href="#__codelineno-0-13"></a>
|
||||
<a id="__codelineno-0-14" name="__codelineno-0-14" href="#__codelineno-0-14"></a><span class="nv">.DEFUALT_GOAL</span> <span class="o">=</span> <span class="nb">help</span>
|
||||
<a id="__codelineno-0-15" name="__codelineno-0-15" href="#__codelineno-0-15"></a><span class="cp">include $(shell git rev-parse --show-toplevel)/task.mk</span>
|
||||
</code></pre></div>
|
||||
|
||||
<hr>
|
||||
|
@ -459,7 +451,7 @@
|
|||
<small>
|
||||
|
||||
Last update:
|
||||
<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">September 18, 2022</span>
|
||||
<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">September 19, 2022</span>
|
||||
|
||||
<br>
|
||||
Created:
|
||||
|
@ -544,8 +536,23 @@
|
|||
<script id="__config" type="application/json">{"base": "../..", "features": ["navigation.indexes"], "search": "../../assets/javascripts/workers/search.ecf98df9.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version.title": "Select version"}}</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="../../assets/javascripts/bundle.39f04ddb.min.js"></script>
|
||||
|
||||
<script src="../../javascripts/asciinema-player.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script async>
|
||||
AsciinemaPlayer.create('./demo.cast', document.getElementById('demo-cast'),{loop: true});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,6 +1,3 @@
|
|||
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
|
||||
|
@ -34,14 +31,6 @@ endef
|
|||
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>
|
||||
|
|
|
@ -420,72 +420,57 @@
|
|||
|
||||
|
||||
|
||||
<a href="https://github.com/daylinmorgan/task.mk/edit/master/docs/examples/embedded/index.md" title="Edit this page" class="md-content__button md-icon">
|
||||
<a href="https://github.com/daylinmorgan/task.mk/edit/main/docs/examples/embedded/index.md" title="Edit this page" class="md-content__button md-icon">
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25Z"/></svg>
|
||||
</a>
|
||||
|
||||
|
||||
<h1 id="embedded">Embedded</h1>
|
||||
<div id="demo"></div>
|
||||
<script src="/javascripts/asciinema-player.min.js"></script>
|
||||
<script async>
|
||||
AsciinemaPlayer.create('./demo.cast', document.getElementById('demo'),{loop: true});
|
||||
</script>
|
||||
<div id="demo-cast"></div>
|
||||
|
||||
<div class="highlight"><span class="filename">embedded.mk</span><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nv">msgfmt</span> <span class="o">=</span> <span class="o">{</span>a.style<span class="o">(</span><span class="s1">'==>'</span>,<span class="s1">'bold'</span><span class="o">)}</span> <span class="o">{</span>a.style<span class="o">(</span><span class="s1">'$(1)'</span>,<span class="s1">'b_magenta'</span><span class="o">)}</span> <span class="o">{</span>a.style<span class="o">(</span><span class="s1">'<=='</span>,<span class="s1">'bold'</span><span class="o">)}</span>
|
||||
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a><span class="nv">msg</span> <span class="o">=</span> <span class="k">$(</span>call tprint,<span class="k">$(</span>call msgfmt ,<span class="k">$(</span><span class="m">1</span><span class="k">)))</span>
|
||||
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a>
|
||||
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a><span class="c">### examples of task.mk features | args: --divider --align center --msg-style b_red</span>
|
||||
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a><span class="cp">define list_files_py</span>
|
||||
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a><span class="err">from</span><span class="w"> </span><span class="err">pathlib</span><span class="w"> </span><span class="err">import</span><span class="w"> </span><span class="err">Path</span><span class="w"></span>
|
||||
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a><span class="err">print(</span><span class="s2">"files in $(2)"</span><span class="err">)</span><span class="w"></span>
|
||||
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a><span class="err">print([f.name</span><span class="w"> </span><span class="err">for</span><span class="w"> </span><span class="err">f</span><span class="w"> </span><span class="err">in</span><span class="w"> </span><span class="err">(Path(</span><span class="s2">"$(2)"</span><span class="err">).iterdir())])</span><span class="w"></span>
|
||||
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a><span class="cp">endef</span>
|
||||
<a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a>
|
||||
<a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a><span class="c">## list-% | use pathlib.Path to list files</span>
|
||||
<a id="__codelineno-0-12" name="__codelineno-0-12" href="#__codelineno-0-12"></a><span class="c">### name the directory in rule (make list-src) | args: --align sep</span>
|
||||
<a id="__codelineno-0-13" name="__codelineno-0-13" href="#__codelineno-0-13"></a><span class="nf">list-%</span><span class="o">:</span>
|
||||
<a id="__codelineno-0-14" name="__codelineno-0-14" href="#__codelineno-0-14"></a> <span class="k">$(</span>call py,list_files_py,<span class="nv">$*</span><span class="k">)</span>
|
||||
<a id="__codelineno-0-15" name="__codelineno-0-15" href="#__codelineno-0-15"></a>
|
||||
<a id="__codelineno-0-16" name="__codelineno-0-16" href="#__codelineno-0-16"></a><span class="c"># dollar signs will always be a problem</span>
|
||||
<a id="__codelineno-0-17" name="__codelineno-0-17" href="#__codelineno-0-17"></a><span class="cp">define bash_script</span>
|
||||
<a id="__codelineno-0-18" name="__codelineno-0-18" href="#__codelineno-0-18"></a><span class="err">echo</span><span class="w"> </span><span class="s2">"Is the process running bash? We can check with ps"</span><span class="w"></span>
|
||||
<a id="__codelineno-0-19" name="__codelineno-0-19" href="#__codelineno-0-19"></a><span class="err">ps</span><span class="w"> </span><span class="err">-o</span><span class="w"> </span><span class="nv">args</span><span class="o">=</span> -p <span class="nv">$$$$</span> <span class="p">|</span> grep -E -m <span class="m">1</span> -o <span class="s1">'\w{0,5}sh'</span>
|
||||
<a id="__codelineno-0-20" name="__codelineno-0-20" href="#__codelineno-0-20"></a><span class="cp">if [ -x "$(command -v figlet)" ]; then</span>
|
||||
<a id="__codelineno-0-21" name="__codelineno-0-21" href="#__codelineno-0-21"></a> <span class="nb">echo</span> <span class="s1">'no figlet :('</span>
|
||||
<a id="__codelineno-0-22" name="__codelineno-0-22" href="#__codelineno-0-22"></a><span class="cp">else</span>
|
||||
<a id="__codelineno-0-23" name="__codelineno-0-23" href="#__codelineno-0-23"></a> <span class="nb">echo</span> <span class="s2">"What text to figlet? "</span>
|
||||
<a id="__codelineno-0-24" name="__codelineno-0-24" href="#__codelineno-0-24"></a> <span class="nb">read</span> name
|
||||
<a id="__codelineno-0-25" name="__codelineno-0-25" href="#__codelineno-0-25"></a> figlet <span class="nv">$$</span>name
|
||||
<a id="__codelineno-0-26" name="__codelineno-0-26" href="#__codelineno-0-26"></a><span class="err">fi</span><span class="w"></span>
|
||||
<a id="__codelineno-0-27" name="__codelineno-0-27" href="#__codelineno-0-27"></a><span class="err">echo</span><span class="w"> </span><span class="s2">"the argument below as given in the makefile itself"</span><span class="w"></span>
|
||||
<a id="__codelineno-0-28" name="__codelineno-0-28" href="#__codelineno-0-28"></a><span class="err">echo</span><span class="w"> </span><span class="s2">"it's expanded before the script is passed to bash"</span><span class="w"></span>
|
||||
<a id="__codelineno-0-29" name="__codelineno-0-29" href="#__codelineno-0-29"></a><span class="err">printf</span><span class="w"> </span><span class="s2">"%s\n"</span><span class="w"> </span><span class="s2">"$(2)"</span><span class="w"></span>
|
||||
<a id="__codelineno-0-30" name="__codelineno-0-30" href="#__codelineno-0-30"></a><span class="cp">endef</span>
|
||||
<a id="__codelineno-0-31" name="__codelineno-0-31" href="#__codelineno-0-31"></a>
|
||||
<a id="__codelineno-0-32" name="__codelineno-0-32" href="#__codelineno-0-32"></a><span class="c">## embedded-bash | bash script with pipes and make input</span>
|
||||
<a id="__codelineno-0-33" name="__codelineno-0-33" href="#__codelineno-0-33"></a><span class="nf">.PHONY</span><span class="o">:</span> <span class="n">embedded</span>-<span class="n">bash</span>
|
||||
<a id="__codelineno-0-34" name="__codelineno-0-34" href="#__codelineno-0-34"></a><span class="nf">embedded-bash</span><span class="o">:</span>
|
||||
<a id="__codelineno-0-35" name="__codelineno-0-35" href="#__codelineno-0-35"></a> <span class="k">$(</span>call tbash,bash_script,bash multiline is probably working<span class="k">)</span>
|
||||
<a id="__codelineno-0-36" name="__codelineno-0-36" href="#__codelineno-0-36"></a>
|
||||
<a id="__codelineno-0-37" name="__codelineno-0-37" href="#__codelineno-0-37"></a><span class="cp">define mlmsg</span>
|
||||
<a id="__codelineno-0-38" name="__codelineno-0-38" href="#__codelineno-0-38"></a><span class="err">{a.b_yellow}</span><span class="w"></span>
|
||||
<a id="__codelineno-0-39" name="__codelineno-0-39" href="#__codelineno-0-39"></a><span class="err">It</span><span class="w"> </span><span class="err">can</span><span class="w"> </span><span class="err">even</span><span class="w"> </span><span class="err">be</span><span class="w"> </span><span class="err">multiline!{a.end}</span><span class="w"></span>
|
||||
<a id="__codelineno-0-40" name="__codelineno-0-40" href="#__codelineno-0-40"></a><span class="err">{a.style(</span><span class="s1">'and styles can be defined'</span><span class="err">,</span><span class="s1">'red'</span><span class="err">)}</span><span class="w"></span>
|
||||
<a id="__codelineno-0-41" name="__codelineno-0-41" href="#__codelineno-0-41"></a><span class="err">as</span><span class="w"> </span><span class="err">python</span><span class="w"> </span><span class="err">{a.bold}f-string{a.end}</span><span class="w"> </span><span class="err">literals</span><span class="w"></span>
|
||||
<a id="__codelineno-0-42" name="__codelineno-0-42" href="#__codelineno-0-42"></a><span class="err">{a.end}</span><span class="w"></span>
|
||||
<a id="__codelineno-0-43" name="__codelineno-0-43" href="#__codelineno-0-43"></a><span class="cp">endef</span>
|
||||
<a id="__codelineno-0-44" name="__codelineno-0-44" href="#__codelineno-0-44"></a>
|
||||
<a id="__codelineno-0-45" name="__codelineno-0-45" href="#__codelineno-0-45"></a><span class="cp">define USAGE</span>
|
||||
<a id="__codelineno-0-46" name="__codelineno-0-46" href="#__codelineno-0-46"></a><span class="nf">{a.$(HEADER_STYLE)}usage</span><span class="o">:</span>{<span class="n">a</span>.<span class="n">end</span>}
|
||||
<a id="__codelineno-0-47" name="__codelineno-0-47" href="#__codelineno-0-47"></a> make <recipe>
|
||||
<a id="__codelineno-0-48" name="__codelineno-0-48" href="#__codelineno-0-48"></a>
|
||||
<a id="__codelineno-0-49" name="__codelineno-0-49" href="#__codelineno-0-49"></a> examples of embedded scripts <span class="k">in</span> <span class="sb">`</span><span class="o">{</span>a.magenta<span class="o">}</span>Makefile<span class="o">{</span>a.end<span class="o">}</span><span class="sb">`</span>
|
||||
<a id="__codelineno-0-50" name="__codelineno-0-50" href="#__codelineno-0-50"></a>
|
||||
<a id="__codelineno-0-51" name="__codelineno-0-51" href="#__codelineno-0-51"></a><span class="cp">endef</span>
|
||||
<a id="__codelineno-0-52" name="__codelineno-0-52" href="#__codelineno-0-52"></a><span class="nv">.DEFUALT_GOAL</span> <span class="o">=</span> <span class="nb">help</span>
|
||||
<a id="__codelineno-0-53" name="__codelineno-0-53" href="#__codelineno-0-53"></a><span class="cp">include $(shell git rev-parse --show-toplevel)/task.mk</span>
|
||||
<div class="highlight"><span class="filename">embedded.mk</span><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="c">### examples of task.mk features | args: --divider --align center --msg-style b_red</span>
|
||||
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a><span class="cp">define list_files_py</span>
|
||||
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a><span class="err">from</span><span class="w"> </span><span class="err">pathlib</span><span class="w"> </span><span class="err">import</span><span class="w"> </span><span class="err">Path</span><span class="w"></span>
|
||||
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a><span class="err">print(</span><span class="s2">"files in $(2)"</span><span class="err">)</span><span class="w"></span>
|
||||
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a><span class="err">print([f.name</span><span class="w"> </span><span class="err">for</span><span class="w"> </span><span class="err">f</span><span class="w"> </span><span class="err">in</span><span class="w"> </span><span class="err">(Path(</span><span class="s2">"$(2)"</span><span class="err">).iterdir())])</span><span class="w"></span>
|
||||
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a><span class="cp">endef</span>
|
||||
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a>
|
||||
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a><span class="c">## list-% | use pathlib.Path to list files</span>
|
||||
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a><span class="c">### name the directory in rule (make list-src) | args: --align sep</span>
|
||||
<a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a><span class="nf">list-%</span><span class="o">:</span>
|
||||
<a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a> <span class="k">$(</span>call py,list_files_py,<span class="nv">$*</span><span class="k">)</span>
|
||||
<a id="__codelineno-0-12" name="__codelineno-0-12" href="#__codelineno-0-12"></a>
|
||||
<a id="__codelineno-0-13" name="__codelineno-0-13" href="#__codelineno-0-13"></a><span class="c"># dollar signs will always be a problem</span>
|
||||
<a id="__codelineno-0-14" name="__codelineno-0-14" href="#__codelineno-0-14"></a><span class="cp">define bash_script</span>
|
||||
<a id="__codelineno-0-15" name="__codelineno-0-15" href="#__codelineno-0-15"></a><span class="err">echo</span><span class="w"> </span><span class="s2">"Is the process running bash? We can check with ps"</span><span class="w"></span>
|
||||
<a id="__codelineno-0-16" name="__codelineno-0-16" href="#__codelineno-0-16"></a><span class="err">ps</span><span class="w"> </span><span class="err">-o</span><span class="w"> </span><span class="nv">args</span><span class="o">=</span> -p <span class="nv">$$$$</span> <span class="p">|</span> grep -E -m <span class="m">1</span> -o <span class="s1">'\w{0,5}sh'</span>
|
||||
<a id="__codelineno-0-17" name="__codelineno-0-17" href="#__codelineno-0-17"></a><span class="cp">if [ -x "$(command -v figlet)" ]; then</span>
|
||||
<a id="__codelineno-0-18" name="__codelineno-0-18" href="#__codelineno-0-18"></a> <span class="nb">echo</span> <span class="s1">'no figlet :('</span>
|
||||
<a id="__codelineno-0-19" name="__codelineno-0-19" href="#__codelineno-0-19"></a><span class="cp">else</span>
|
||||
<a id="__codelineno-0-20" name="__codelineno-0-20" href="#__codelineno-0-20"></a> <span class="nb">echo</span> <span class="s2">"What text to figlet? "</span>
|
||||
<a id="__codelineno-0-21" name="__codelineno-0-21" href="#__codelineno-0-21"></a> <span class="nb">read</span> name
|
||||
<a id="__codelineno-0-22" name="__codelineno-0-22" href="#__codelineno-0-22"></a> figlet <span class="nv">$$</span>name
|
||||
<a id="__codelineno-0-23" name="__codelineno-0-23" href="#__codelineno-0-23"></a><span class="err">fi</span><span class="w"></span>
|
||||
<a id="__codelineno-0-24" name="__codelineno-0-24" href="#__codelineno-0-24"></a><span class="err">echo</span><span class="w"> </span><span class="s2">"the argument below as given in the makefile itself"</span><span class="w"></span>
|
||||
<a id="__codelineno-0-25" name="__codelineno-0-25" href="#__codelineno-0-25"></a><span class="err">echo</span><span class="w"> </span><span class="s2">"it's expanded before the script is passed to bash"</span><span class="w"></span>
|
||||
<a id="__codelineno-0-26" name="__codelineno-0-26" href="#__codelineno-0-26"></a><span class="err">printf</span><span class="w"> </span><span class="s2">"%s\n"</span><span class="w"> </span><span class="s2">"$(2)"</span><span class="w"></span>
|
||||
<a id="__codelineno-0-27" name="__codelineno-0-27" href="#__codelineno-0-27"></a><span class="cp">endef</span>
|
||||
<a id="__codelineno-0-28" name="__codelineno-0-28" href="#__codelineno-0-28"></a>
|
||||
<a id="__codelineno-0-29" name="__codelineno-0-29" href="#__codelineno-0-29"></a><span class="c">## embedded-bash | bash script with pipes and make input</span>
|
||||
<a id="__codelineno-0-30" name="__codelineno-0-30" href="#__codelineno-0-30"></a><span class="nf">.PHONY</span><span class="o">:</span> <span class="n">embedded</span>-<span class="n">bash</span>
|
||||
<a id="__codelineno-0-31" name="__codelineno-0-31" href="#__codelineno-0-31"></a><span class="nf">embedded-bash</span><span class="o">:</span>
|
||||
<a id="__codelineno-0-32" name="__codelineno-0-32" href="#__codelineno-0-32"></a> <span class="k">$(</span>call tbash,bash_script,bash multiline is probably working<span class="k">)</span>
|
||||
<a id="__codelineno-0-33" name="__codelineno-0-33" href="#__codelineno-0-33"></a>
|
||||
<a id="__codelineno-0-34" name="__codelineno-0-34" href="#__codelineno-0-34"></a><span class="cp">define USAGE</span>
|
||||
<a id="__codelineno-0-35" name="__codelineno-0-35" href="#__codelineno-0-35"></a><span class="nf">{a.$(HEADER_STYLE)}usage</span><span class="o">:</span>{<span class="n">a</span>.<span class="n">end</span>}
|
||||
<a id="__codelineno-0-36" name="__codelineno-0-36" href="#__codelineno-0-36"></a> make <recipe>
|
||||
<a id="__codelineno-0-37" name="__codelineno-0-37" href="#__codelineno-0-37"></a>
|
||||
<a id="__codelineno-0-38" name="__codelineno-0-38" href="#__codelineno-0-38"></a> examples of embedded scripts <span class="k">in</span> <span class="sb">`</span><span class="o">{</span>a.magenta<span class="o">}</span>Makefile<span class="o">{</span>a.end<span class="o">}</span><span class="sb">`</span>
|
||||
<a id="__codelineno-0-39" name="__codelineno-0-39" href="#__codelineno-0-39"></a>
|
||||
<a id="__codelineno-0-40" name="__codelineno-0-40" href="#__codelineno-0-40"></a><span class="cp">endef</span>
|
||||
<a id="__codelineno-0-41" name="__codelineno-0-41" href="#__codelineno-0-41"></a><span class="nv">.DEFUALT_GOAL</span> <span class="o">=</span> <span class="nb">help</span>
|
||||
<a id="__codelineno-0-42" name="__codelineno-0-42" href="#__codelineno-0-42"></a><span class="cp">include $(shell git rev-parse --show-toplevel)/task.mk</span>
|
||||
</code></pre></div>
|
||||
|
||||
<hr>
|
||||
|
@ -493,7 +478,7 @@
|
|||
<small>
|
||||
|
||||
Last update:
|
||||
<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">September 18, 2022</span>
|
||||
<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">September 19, 2022</span>
|
||||
|
||||
<br>
|
||||
Created:
|
||||
|
@ -563,8 +548,23 @@
|
|||
<script id="__config" type="application/json">{"base": "../..", "features": ["navigation.indexes"], "search": "../../assets/javascripts/workers/search.ecf98df9.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version.title": "Select version"}}</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="../../assets/javascripts/bundle.39f04ddb.min.js"></script>
|
||||
|
||||
<script src="../../javascripts/asciinema-player.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script async>
|
||||
AsciinemaPlayer.create('./demo.cast', document.getElementById('demo-cast'),{loop: true});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -418,7 +418,7 @@
|
|||
|
||||
|
||||
|
||||
<a href="https://github.com/daylinmorgan/task.mk/edit/master/docs/examples/index.md" title="Edit this page" class="md-content__button md-icon">
|
||||
<a href="https://github.com/daylinmorgan/task.mk/edit/main/docs/examples/index.md" title="Edit this page" class="md-content__button md-icon">
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25Z"/></svg>
|
||||
</a>
|
||||
|
@ -526,8 +526,19 @@
|
|||
<script id="__config" type="application/json">{"base": "..", "features": ["navigation.indexes"], "search": "../assets/javascripts/workers/search.ecf98df9.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version.title": "Select version"}}</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="../assets/javascripts/bundle.39f04ddb.min.js"></script>
|
||||
|
||||
<script src="../javascripts/asciinema-player.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
21
index.html
21
index.html
|
@ -508,7 +508,7 @@
|
|||
|
||||
|
||||
|
||||
<a href="https://github.com/daylinmorgan/task.mk/edit/master/docs/index.md" title="Edit this page" class="md-content__button md-icon">
|
||||
<a href="https://github.com/daylinmorgan/task.mk/edit/main/docs/index.md" title="Edit this page" class="md-content__button md-icon">
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25Z"/></svg>
|
||||
</a>
|
||||
|
@ -535,17 +535,17 @@ to add some QOL improvements for your users and fellow maintainers.</p>
|
|||
</ul>
|
||||
<p>Depends on <code>GNU Make</code>, obviously and <code>Python >=3.7</code>.</p>
|
||||
<p>Wait python?!?!, I'm not <code>pip</code> installing some package just to parse my makefile.
|
||||
I agree, all you need is one file <a href="https://github.com/daylinmorgan/task.mk/blob/main/task.mk"><code>.task.mk</code></a>.
|
||||
I agree, all you need is one file <a href="https://github.com/daylinmorgan/task.mk/v22.9.19/task.mk"><code>.task.mk</code></a>.
|
||||
You can automagically include it with just two additional lines to your <code>Makefile</code> (and probably one to your <code>.gitignore</code>) and your good to go.</p>
|
||||
<h2 id="setup">Setup</h2>
|
||||
<p>You can include this as an optional dependency on your project by adding the below lines to the end of your <code>Makefile</code>.
|
||||
If someone tries to invoke <code>make help</code> it will download <code>.task.mk</code> for them.</p>
|
||||
<div class="highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="cp">-include .task.mk</span>
|
||||
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a><span class="nf">$(if $(filter help,$(MAKECMDGOALS)),$(if $(wildcard .task.mk),,.task.mk</span><span class="o">:</span> ; <span class="n">curl</span> -<span class="n">fsSL</span> <span class="n">https</span>://<span class="n">raw</span>.<span class="n">githubusercontent</span>.<span class="n">com</span>/<span class="n">daylinmorgan</span>/<span class="n">task</span>.<span class="n">mk</span>/<span class="n">v</span>22.9.14/<span class="n">task</span>.<span class="n">mk</span> -<span class="n">o</span> .<span class="n">task</span>.<span class="n">mk</span>))
|
||||
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a><span class="nf">$(if $(filter help,$(MAKECMDGOALS)),$(if $(wildcard .task.mk),,.task.mk</span><span class="o">:</span> ; <span class="n">curl</span> -<span class="n">fsSL</span> <span class="n">https</span>://<span class="n">raw</span>.<span class="n">githubusercontent</span>.<span class="n">com</span>/<span class="n">daylinmorgan</span>/<span class="n">task</span>.<span class="n">mk</span>/<span class="n">v</span>22.9.19/<span class="n">task</span>.<span class="n">mk</span> -<span class="n">o</span> .<span class="n">task</span>.<span class="n">mk</span>))
|
||||
</code></pre></div>
|
||||
<p>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 <code>$(MAKECMDGOALS)</code> check.</p>
|
||||
<div class="highlight"><pre><span></span><code><a id="__codelineno-1-1" name="__codelineno-1-1" href="#__codelineno-1-1"></a><span class="cp">-include .task.mk</span>
|
||||
<a id="__codelineno-1-2" name="__codelineno-1-2" href="#__codelineno-1-2"></a><span class="nf">$(if $(wildcard .task.mk),,.task.mk</span><span class="o">:</span> ; <span class="n">curl</span> -<span class="n">fsSL</span> <span class="n">https</span>://<span class="n">raw</span>.<span class="n">githubusercontent</span>.<span class="n">com</span>/<span class="n">daylinmorgan</span>/<span class="n">task</span>.<span class="n">mk</span>/<span class="n">v</span>22.9.14/<span class="n">task</span>.<span class="n">mk</span> -<span class="n">o</span> .<span class="n">task</span>.<span class="n">mk</span>)
|
||||
<a id="__codelineno-1-2" name="__codelineno-1-2" href="#__codelineno-1-2"></a><span class="nf">$(if $(wildcard .task.mk),,.task.mk</span><span class="o">:</span> ; <span class="n">curl</span> -<span class="n">fsSL</span> <span class="n">https</span>://<span class="n">raw</span>.<span class="n">githubusercontent</span>.<span class="n">com</span>/<span class="n">daylinmorgan</span>/<span class="n">task</span>.<span class="n">mk</span>/<span class="n">v</span>22.9.19/<span class="n">task</span>.<span class="n">mk</span> -<span class="n">o</span> .<span class="n">task</span>.<span class="n">mk</span>)
|
||||
</code></pre></div>
|
||||
<p>Alternatively, you can use the builtin rule <code>_update-task.mk</code> to update to the latest development version.</p>
|
||||
<p>See <a href="./usage">Usage</a> to get started running all your tasks.
|
||||
|
@ -582,7 +582,7 @@ But like <code>just</code> it's a tool people don't usually already have and it'
|
|||
<small>
|
||||
|
||||
Last update:
|
||||
<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">September 18, 2022</span>
|
||||
<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">September 19, 2022</span>
|
||||
|
||||
<br>
|
||||
Created:
|
||||
|
@ -652,8 +652,19 @@ But like <code>just</code> it's a tool people don't usually already have and it'
|
|||
<script id="__config" type="application/json">{"base": ".", "features": ["navigation.indexes"], "search": "assets/javascripts/workers/search.ecf98df9.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version.title": "Select version"}}</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="assets/javascripts/bundle.39f04ddb.min.js"></script>
|
||||
|
||||
<script src="javascripts/asciinema-player.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
16
overrides/main.html
Normal file
16
overrides/main.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block scripts %}
|
||||
|
||||
{{ super() }}
|
||||
|
||||
{% if page.meta %}
|
||||
{% if page.meta.asciinema %}
|
||||
<script async>
|
||||
AsciinemaPlayer.create('./demo.cast', document.getElementById('demo-cast'),{loop: true});
|
||||
</script>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% endblock %}
|
File diff suppressed because one or more lines are too long
10
sitemap.xml
10
sitemap.xml
|
@ -2,27 +2,27 @@
|
|||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url>
|
||||
<loc>https://gh.dayl.in/task.mk/</loc>
|
||||
<lastmod>2022-09-18</lastmod>
|
||||
<lastmod>2022-09-19</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://gh.dayl.in/task.mk/usage/</loc>
|
||||
<lastmod>2022-09-18</lastmod>
|
||||
<lastmod>2022-09-19</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://gh.dayl.in/task.mk/examples/</loc>
|
||||
<lastmod>2022-09-18</lastmod>
|
||||
<lastmod>2022-09-19</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://gh.dayl.in/task.mk/examples/check/</loc>
|
||||
<lastmod>2022-09-18</lastmod>
|
||||
<lastmod>2022-09-19</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://gh.dayl.in/task.mk/examples/embedded/</loc>
|
||||
<lastmod>2022-09-18</lastmod>
|
||||
<lastmod>2022-09-19</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
</urlset>
|
BIN
sitemap.xml.gz
BIN
sitemap.xml.gz
Binary file not shown.
|
@ -486,7 +486,7 @@
|
|||
|
||||
|
||||
|
||||
<a href="https://github.com/daylinmorgan/task.mk/edit/master/docs/usage.md" title="Edit this page" class="md-content__button md-icon">
|
||||
<a href="https://github.com/daylinmorgan/task.mk/edit/main/docs/usage.md" title="Edit this page" class="md-content__button md-icon">
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25Z"/></svg>
|
||||
</a>
|
||||
|
@ -672,8 +672,19 @@ If you need to debug your python script, use <code>DEBUG=1</code> when you run <
|
|||
<script id="__config" type="application/json">{"base": "..", "features": ["navigation.indexes"], "search": "../assets/javascripts/workers/search.ecf98df9.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version.title": "Select version"}}</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="../assets/javascripts/bundle.39f04ddb.min.js"></script>
|
||||
|
||||
<script src="../javascripts/asciinema-player.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue