4 ms·
This looks a lot like an idea I am having for a shell written in GNU Guile. MI am still at the very beginning and POC phase. My ideas are: (1) making it possib
by zelphirkalt 3y ago
This looks a lot like an idea I am having for a shell written in GNU Guile. MI am still at the very beginning and POC phase. My ideas are:
(1) making it possible to have any procedure that follows a certain interface to be usable as a "command" in the shell
(2) have a fallback function, that gives you a procedure for a standard shell command like 'ls' (or reimplement your own!)
(3) have piped commands automatically use lightweight processes (guile-fibers) to automatically parallelize work, if possible
(4) pass structured data instead of strings, unless the structured data is actually a string or a fallback command of standard shell is used (although perhaps one could write functions parsing that string output into structured data and have structured data at the next step ...)
(5) provide composition concepts, that make it easy to compose commands or pipe their outputs into other commands
(6) have readable arguments for things like input or output redirection
(7) no need to be POSIX compatible, I just want a useful tool for myself and anyone, who might want to try it at some point. Don't want to get mired in arcane stuff.
Well, many things to consider, probably tons of work hiding somewhere under the hood of all this. I also noticed there are issues with parallelizing things, if I want to keep the shell state local to a command. Previous commands in a pipeline would have to communicate shell state updates down the pipeline. So one needs to distinguish between communication of a shell state update and more input for the next command. Concurrency issues might ensue. I think I will be glad, if I can get some subset of my goals to work.
- celeritascelery 3y agoThis seems like it has some really cool ideas! This reminds me a little of eshell, which has some of the same features around allowing you to define shell functions in lisp. However it does run into issues moving between the lisp (sexp) and shell (string) boundaries.
- geophile 3y agoA lot of this is already in marcel. A command run from the command line is a pipeline, e.g. list files recursively and output (path, filesize): ls -fr | (f: (f, f.size)) But now limit the command to .py files: ls -fr | select (f: f.suffix == '.py') | (f: (f, f.size)) Also, just look at files changed in the past day: ls -fr | select (f: f.suffix == '.py') | select (f: now() - f.mtime < days(1)) | (f: (f, f.size)) Those selects can be abstracted. They can be turned into their own parameterized pipelines, and assigned to variables. Here is a pipeline to filter files by a given extension: ext = (| e: select (f: f.suffix == '.' + e) |) And for files changed in the last d days: recent = (| d: select (f: now() - f.mtime < days(int(d))) |) So the original pipeline becomes: ls -fr | ext py | recent 1 | (f: (f, f.size))