Marcel (and osh) rely on Python types and language where typical shells have sublanguages. So instead of awk or find and their sublanguages, you just use Python. Instead of piping strings, you pipe streams of Python values.
Marcel lets you use Python on the commmand line. It also has an API which allows you to use shell-like commands inside of Python programs.
I mention this specifically, here, because of the CSV point. Marcel handles CSV, e.g. "read --csv foobar.csv" reads the foobar.csv file, parses the input (getting quotes and commas correct), and yields a stream of Python tuples, splitting each line of the CSV into the elements of the output tuples.
Marcel also supports JSON input, translating JSON structures into Python equivalents. (The "What's New" section of marcel's README has more information on JSON support, which was just added.)
E.g.
from marcel.api import *
for file, size in (ls('marcel',
'test',
file=True,
recursive=True) |
map(lambda f: (f.path, f.size))):
print(f'{file}: {size}')
judging by the nickname and github url it's yours https://github.com/geophile/marcel
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://github.com/geophile/marcel.
for file, size in ls('/home/jao') | map(lambda f: (f, f.size)):
print(f'{file.name}: {size}')
- Based on Python -- filter, transform, etc. using Python functions.
- Pipe Python values, not strings.
- Database operations from the command line.
- Run commands remotely and combine results.
I'm developing a shell based on these ideas: https://github.com/geophile/marcel.
Delighted to read these stories about even-older-than-me old-timers. Even though I am a relative spring chicken, I'll list my old-timey computing experiences:
- Started programming on programmable Wang and Monroe calculators.
- PDP-8m in high school. 12k 12-bit words for four terminals running Basic. By special arrangement, I could take over the whole thing and use FORTRAN.
- IBM-370 in college, and I spent lots of hours on an IBM 029 keypunch. (That's where I developed my love of loud, clicky keyboards.)
- First job with Datasaab (yes, a computer division of Saab), and I programmed in their weird DIL-16 language.
- PDP-11 in grad school.
- Various VAXen in my early working life. Picked up Emacs in 1985 and now it's in my fingertips.
- A buddy and I wrote a book intended to support people who needed to work with a large variety of computing environments, (a real problem my buddy encountered). It was instantly obsolete, as it was published as minis were dying and PCs were becoming dominant. (https://www.amazon.ae/Computer-Professionals-Quick-Reference...)
- Many years in startups, mostly in Unix/Linux environments.
Retired now, but still enjoying programming. Having a blast with my current project: https://github.com/geophile/marcel.