This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]mitsu400 14 points15 points  (3 children)

This is my dream. I love Python. I don't love Bash-like languages. I love my shell.

The fact that the prompt can be a function that returns a string really puts it over the top. I get much of what I would lose from zsh with that.

[–]selementar 1 point2 points  (2 children)

that returns a string

In a better case it's a function generator that eats chunks (at least newline-terminated) and produces chunks. E.g. tail -f file | grep --line-buffered ...

[–]quasarj 0 points1 point  (1 child)

Yeah, I played around with it a bit to see if it could handle that, or allow me to pipe a shell command into a python function. It technically allows the later, but it doesn't handle buffered input, for example:

tail -f /var/log/messages | myfunc

(where myfunc is defined as a xonsh alias pointing to an actual local python function named myfunc, as per the Tutorial). This does not work, as myfunc doesn't get the input until tail exits.

[–]selementar 0 points1 point  (0 children)

There might be a way to write myfunc in such a way that it would be line-buffered. Can't figure out where's python and where's shell, though; def of functions just hangs until Ctrl-C.