4 ms·
In fact, I rely on that sort of early termination / circuit breaking as a feature! That is a big reason why I use functions. They help me define sane fallbacks
by adityaathalye 4y ago
In fact, I rely on that sort of early termination / circuit breaking as a feature!
That is a big reason why I use functions. They help me define sane fallbacks, and/or enforce API contracts. Those, in turn, are points where I can enforce "fail and die" behaviour.
Design notes: https://www.evalapply.org/posts/shell-aint-a-bad-place-to-fp-part-2-functions-as-unix-tools/index.html#use-parameter-substitutions-and-local-scope-variables https://www.evalapply.org/posts/shell-aint-a-bad-place-to-fp...
Example from shite: Hard stop if mandatory front matter for posts is absent:
https://github.com/adityaathalye/shite/blob/master/bin/templates.sh#L187 https://github.com/adityaathalye/shite/blob/master/bin/templ...
edit: clarity
- 082349872349872 4y agonice ... and the Heredocs are a nice way to template!
- adityaathalye 4y agoRight?! It was a bit of a lightbulb moment. I wanted a way to just write HTML templates. What really sealed the deal was the ability to punch content from stdin anywhere within a heredoc's scope using `$(cat -)`: https://github.com/adityaathalye/shite#templating-system https://github.com/adityaathalye/shite#templating-system