4 ms·
Marcel is another pipe-objects-instead-of-strings shell. It takes a different approach to shell/language unification, compared to nushell and other modern shell
by geophile 6y ago
Marcel is another pipe-objects-instead-of-strings shell. It takes a different approach to shell/language unification, compared to nushell and other modern shells. Marcel exposes Python on the command line, e.g. to find files that changed in the last day:
ls -fr | select (f: now() - f.mtime < days(1))
ls pipes File objects to the select, and that's a Python function inside the parens.
Scripting is done in Python, using marcel's shell commands as functions, by importing the module marcel.api. So the examle above in Python would be:
from marcel.api import *
for file in (ls(file=True, recursive=True) |
select(lambda f: now() - f.mtime < days(1))):
print(file)
So it's the same shell command (ls ... | select ...), but expressed as Python functions, and the result is an iterator so that the command output can be used inside a for loop.
For more info: https://www.marceltheshell.org https://www.marceltheshell.org, https://github.com/geophile/marcel https://github.com/geophile/marcel.
- xfer 6y agoIt's not a different approach though. It works exactly the same way in powershell(just the host language is different).
- geophile 6y agoThanks, I wasn't aware of that. I believe my comment still applies to nushell and a couple of others. I like bash for simple commands, but hate the requirement to learn so many sublanguages for more sophisticated usage, (as in sed, awk, find, and others). I like Python for scripting, but the integration of shell commands is really not very good. I built marcel to fix both of these problems.
- vips7L 6y agoPowershell scripting is still done in the powershell language, but you can import all of the .net/c# runtime to use. I'd like to build the same but using the JVM/groovy as the runtime/scripting language.