Open balupton opened 10 months ago
One idea here is to introduce reimplementations of each of the simpler commands/ for the different shells, but with the same test suite. So for instance: is-integer is bash, but is-integer.nu is with nushell. This could become an invaluable resource for shell scripters, while also allowing overlay shells like Nushell to work more seamlessly with command invocations.
For scripting,
So far I haven't found any that offer a sensible errexit, however Ruby's ability to metaprogram could enable this: https://stackoverflow.com/a/30940226/130638
The snippet from that example doesn't support ignoring failures for executions which we don't care if they fail, and from my limited ruby experience will crash the whole app.
The ideal, would be the way it works from bash.bash, which is all unignored exit statuses trigger an exception, which can be caught by eval_capture
Perhaps such can be metaprogrammed for Ruby. If so, I wonder about Ruby's performance and also if it can be compiled into portable binaries.
Higher level options like Deno could be done via function calls, however that becomes messy for piping and escaping, and as nearly everything is an invocation we don't want to do function calls for everything.
Nu I hope will be the best contender, however they haven't ratified or even started their exception handling yet.
Seems great, this could be it:
I've made https://github.com/stars/balupton/lists/shells with a list of all the shells I know about
As Dorothy is cross-shell compatible, here are additional shells we could target:
[ ] murex
[ ] ion
Listings of shells:
Note that Dorothy commands need not be coded in a language optimised for interactive login shells, as such here are alternatives for writing Dorothy commands: