Heykuki News

TopNewBestAskShowJobs
TopNewBestAskShowJobs
Show HN: Replace shell commands with bun shell typescript scripts
github.com/aadalal
1 point
aagamd
4 days ago
I am very bad at remembering shell command options, so I often prefer to use scripts. But shell commands are nice because 1) I can just press ↑ to iterate 2) scripts need a name and location, which is hard to think of 3) they make it so easy to interact with files!

bunsh aims to bridge the cap. It's a little utility that drops you into $EDITOR and lets you write a script. When you finish, the script is executed and you can see the output in your shell. bunsh can also edit your shell history so that when you press ↑ you see `bunsh <some-script-you-were-working-on>`

It solves painpoint 1) and 2) from above by collapsing the typical `vim/hx <some-script>` and `node/python <some-script>` into just `bunsh` and then ↑ for each further iteration. Bun handles 3) because of its shell (https://bun.com/docs/runtime/shell) module, which lets you interoperate between shell commands and JS (so e.g., you can use cat)