Posted by dim0x69 1 day ago
Key Features:
- Define dependencies between commands
- Supports shebangs
- Ability to pass arguments to code blocks
Would love feedback and thoughts!
Ref. makedown: https://github.com/tzador/makedown. Thanks for the idea! :)
https://github.com/coezbek/baker
I call this a Project-Setup-as-Code tool.
Supports backticks for shell and triple backticks for executing Ruby code.
If blocks are successfully executed they are marked as done (using markdown [x] checkboxes). So you can incrementally run a file without executing stuff twice.
chatgpt -m "I'm feeling lucky" | sudo bash
Org mode is stellar at that "code in document" tangling, but I'll be honest that I loathe the M-| behavior in emacs since, unlike its vim friend, it puts the output in a separate buffer, placing the burden upon me to copy/cut it back into the source buffer
If you like this, another similar tool, though one specifically geared towards builds, is xc.
```sh name="build" deps=["install"]
npm run build
```
This would be displayed just fine in github, as it is valid gfm.
1: https://github.com/stateful/runme#runme-runs-markdown-- (Apache 2, golang)
I wondered why Runme wasn't already mentioned but it seems the comment got nested under a dead thread https://news.ycombinator.com/item?id=41955834
In some of my projects I have little snippets of cli commands in the main README.
When I open the project in JetBrains IDE and I open the README of my project there, I can click on each code block to run it.
This way I can for example start up dependencies like say a little python3 web server to serve static files from one of the subdirs, simply by clicking on it in the readme. Instead of copy-pasting from the readme, and even instead of Ctrl+R in a terminal window and finding the correct commands for a project from history.
It almost reminds me a little bit of Plan9 and their Acme editor, where they were blurring the lines between text and commands. In Acme you can type a piece of text and then middle-button click I think it was to run the text as a command. Having executable blocks of code interspersed in a markdown document feels a little bit like that although in a different, more limited manner.
It was like a super rudimentary Jupyter Notebook system of my own making.
Eventually I switched away from my own run-and-insert system.
We could expect failure conditions or assert correct outcomes.
It could become a little library of examples that change over time, as the software changes, granting us peace of mind that everything still works.