bevry / dorothy

🧙🏻‍♀️ Bring your dotfile commands and configuration to any shell. Sensible defaults and hundreds of commands preloaded. Supports Bash, Zsh, Fish, Nu, Xonsh, Elvish, Dash, KornShell, macOS, Linux, Windows.
Other
277 stars 21 forks source link

Ongoing: additional shell support #207

Open balupton opened 5 months ago

balupton commented 5 months ago

As Dorothy is cross-shell compatible, here are additional shells we could target:

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:

balupton commented 5 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.

balupton commented 4 months ago

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.

balupton commented 4 months ago

Seems great, this could be it:

https://github.com/dsherret/dax