3 ms·
I'd be curious on your thoughts on my entry: https://marceltheshell.org https://marceltheshell.org. (This website has lots of examples, so you can get a sense o
by geophile 3y ago
I'd be curious on your thoughts on my entry: https://marceltheshell.org https://marceltheshell.org. (This website has lots of examples, so you can get a sense of how it works without installing.)
- frou_dh 3y agoPersonally I wouldn't use a full-on replacement interactive shell because I have a stacked .bashrc that I've constructed over a long time, and things I install from my package manager all come with bash_completion support etc, and even scripts written in Python can vend bash completions (https://pypi.org/project/argcomplete/ https://pypi.org/project/argcomplete/). Also shellcheck's static analysis of scripts is very educational and that feeds back into interactive use. I like that you support the scripting use case with vanilla Python syntax. That's something that made Xonsh a non-starter for me (I'm not going to write scripts when syntax highlighting and auto-formatting don't work because it's a superset of valid Python syntax). Evidently my definition of "going off the deep end" here is giving up lots of working tooling and integrations.
- geophile 3y agoThanks. Lately I've been finding it useful to write bash scripts with some marcel, e.g. #!/bin/bash echo ... pushd ... marcel <<EOF ... EOF
- grrandalf 3y agoThanks for posting. Interesting tool -- I'll take a look at this. "Saving streams" is killer. I've been "meaning to build something to solve that" for a looong time. :) :) But you did. Thanks!! https://www.marceltheshell.org/saving-and-recalling-streams https://www.marceltheshell.org/saving-and-recalling-streams ----- One feature request to think about if it doesn't exist: defining multiline functions right at the prompt, which you later export to a .py file. So I think a decent inline editor with support for arrow keys might be useful. https://www.marceltheshell.org/functions-1 https://www.marceltheshell.org/functions-1 This is not a showstopper obviously. The current 'import' functionality should be enough for me for now. Why inline vs. shelling out a dedicated editor: because replacing the screen will take me out of flow because I frequently refer to previous commands' output on the terminal when constructing/editing the next command.
- geophile 3y agoThank you! One change from the stream page: > and >> now redirect to files in the traditional Unix/Linux way. (That older behavior was just too ingrained and I imagine it is for lots of people.) Use >$ and >>$ to store in variables that don't survive your session. (The $ is meant to evoke an association with variables.) Multiline functions can be defined right now: M 0.18.3 jao@loon ~$ f = (lambda: \ M +$ lambda x, y: x + y \ M +$ ) M 0.18.3 jao@loon ~$ (f(3,4)) 7 So all that would be needed is a way to dump them into a file. That should be doable with another function. One thing to note: You have choices beyond inline and imports for defining new functions. There is a startup file, typically in ~/.config/marcel/startup.py. You can define functions in there, or do imports. The REPL loop checks for modifications to that file, so if you change it, you pick up the changes for your next command. For example, I just put this into my startup file: def hello(x): return f'Hello {x}' and then without restarting marcel: M 0.18.3 jao@loon ~$ (hello('world')) Hello world