commits
Relatively straightforward to implement now that we have so much of the
machinery!
Unfortunately this work got complicated quickly and resulted in more
fixes and features than I wished. Primarily, we now have subshell
support. This also meant rejigging how we expand and collect variable
assignments. There is a new, rather janky, concept of local_state which
is something we clear immediately after executing a command. This might
need some more work in the future.
Using glob(3) this adds simple glob support. I'm sure this isn't
sufficient for all of the pattern-matching that is possible in POSIX
shell's, but it is a good start.
This introduces a `'a Exit.t` type for handling exit codes during the
execution of a series of commands. This is useful because unlike a
`Result.t` a non-zero exit code does not always mean _unrecoverable
error_.
We create the infrastructure necessary to support shell built-ins. The
built-ins `cd` and `pwd` are added and lightly tested.
We disable all the necessary flags (and restore them) for entering
raw mode!
Shells are always more fun when there is an interactive mode to play
around with. Here we vendor Shelter's ANSI-ready copy of ocaml-linenoise
and add a simple interactive loop to osh!
Commands separated by newlines or semicolons will now be executed
sequentially. The logic for commands that exit with non-zero exit codes
will still need some close work.
This logic also comes with a vendoring of the inherit_fds logic too.
See the corresponding issue on Eio's page: https://github.com/ocaml-multicore/eio/issues/826
Substitute the default FDs into the various redirection operators.
Unfortunately this work got complicated quickly and resulted in more
fixes and features than I wished. Primarily, we now have subshell
support. This also meant rejigging how we expand and collect variable
assignments. There is a new, rather janky, concept of local_state which
is something we clear immediately after executing a command. This might
need some more work in the future.