Show HN: Xc – A Markdown Defined Task Runner
github.com
github.com
I'm the creator of mask which is another alternative, written in Rust. Our approaches slightly differ. It looks like xc parses the README.md file for commands while mask looks for a maskfile.md by default, though you can provide a --maskfile arg to specify any markdown file that follows the expected format.
Most code editor will syntax highlight it a lot better.
We started with the documentation-centric approach because we had a lot of documentation and wanted to check if the code examples in them worked. So I wrote a bad parser that extracted the code from rST and put them into python files that we then ran. This worked... ok-ish.
Then we switched to the code-centric approach that we use today where we write tests that we generate the documentation from. There are specially marked documentation strings plus some tags for parts of the tests that shouldn't be included in the generated documentation, and some other cool little features like saving down the output of test requests to their own html files and then embedding them with iframes instead of using screenshots.
I am a programmer so I like the code-centric approach more, but they are pretty similar. The big thing is that you need to control the file format/parser yourself.
Mask takes advantage of the markdown structure in a few ways. Headings define top-level commands and subheadings represent nested subcommands, which makes it extremely easy to structure a command tree. Also, mask checks the code block lang code (ruby, python, js, fish, etc…) and executes the script using that runtime as long as you have it installed. There’s other features, but those two are great examples why markdown works well as a command definition format.
Really? I thought most now understood markdown code blocks with language tag?
Use case, I'm on Mac OS X (aka not Linux, not Windows). I have an Apple M1 processor (aka not x86_64). I have 8GB of RAM (silly mistake on my end, I know). Therefore, Docker + virtual machine based solutions are too expensive memory wise.
However, I also like to think in terms of "let me separate this functionality into say... a Kubernetes workload like a pod"
There's no good containerization solution for Mac OS.
Can something like `mask` be used to achieve basically a "poor man's k8s" for a long running service?
Basically, run these 5 or 6 services in parallel, let me be able to see their logs individually.
If not, I completely understand. I just can't tell if there is an actual need for a solution like this, if it already exists and I just can't find it, etc.
You don't get any containerization/isolation benefits obviously, but it sounds like you've already accepted that.
[1] http://supervisord.org/ [2] https://github.com/Unitech/pm2
There are multiple implementations of it, heres the canonical one: https://github.com/ddollar/foreman And heres a go version that's easier to install and use: https://github.com/ddollar/forego
Regarding docker, I haven't tried it on M1 yet. However, I've been using Ubuntu multipass [1] for over a year now and I'm very happy with it. It makes it easy to set up and manage VMs for different projects, and it seems to run very efficiently on macOS in my experience. When a project needs a docker container like postgres, I just run docker compose inside the VM rather than running it directly in macOS. You can also limit the amount of CPU/RAM the VM uses to keep things under control.
It's typically paired with Taiko for test automation, but generally speaking it's a markdown to logical instruction engine.
I dig it, but also worth taking a look at what the Thoughtworks team has done especially around the VS Code tooling and language server work that they did to bring intellisense into their Markdown templates.
this is a trival thing to achieve in emacs or org mode or babel in a number of ways.
Why is copy and paste hard to do though?
(It probably genuinely is in the infamous Dropbox thread somewhere - 'not only that but it's also built in to emacs'!)
Org mode is far from trivial! when a commenter posts about org mode on an article like this, consider it an invitation to explore something deep and wonderful rather than a claim that the problem being solved is trivial!
PHONY: comment
comment:
TEXT=“yes, I also wonder why people don’t use simple makefiles” $(MAKE) publish
publish:
echo “$(TEXT)”
Some “simple” things like passing arguments to a task become incredibly complex.I’ve been playing around with https://github.com/casey/just and so far it’s been very pleasant.
Personally I have no problems with makefiles but I see the appeal.
* https://github.com/TekWizely/run
Feels like make (by design) but purpose-built for managing small tasks.
Other comments have pointed it out, but the only issue I see is that shell commands aren't trivially usable on e.g. Windows. I'm sure there are good solutions out there for this, but I haven't found them yet...
The only constraint at the moment is if an executable is used that isn't available on the system.
I liked the idea, although didn't go much further with the project.
* https://github.com/TekWizely/run
I built it to feel like make, but be better at managing tasks and wrappers.
If you are evaluating task runners and appreciate the simplicity of Make's syntax, I hope you'll give Run a try.
https://deno.land/x/markdown_player@v1.2.3
OCaml users also like omd. Iirc omd is a bit ocaml specific tho
This tool tries out the idea that maybe if the readme was structured the right way, it could double as the task runner specification. That way, even if you don't have the tool installed (maybe because you're browsing the repo online instead of in your editor) you can still see what the tasks do alongside their instructions
Also non trivial Makefiles quickly become an unintelligible mess of rules both explicit and implicit, and an endless stack of variables that never feel fully defined.
[1] https://www.gnu.org/software/make/manual/html_node/Flavors.h...
People make good jokes but anyone asserting that official GNU documentation is anything short of wonderful needs to learn to read again.
I created a tool that allows you to define tasks in the easy make-style, but is purpose-build to be a task runner:
BTW, it would be great if it had .env support!