terrycojones / daudin

A Python command-line shell
MIT License
176 stars 9 forks source link

🐚 daudin xontrib for xonsh #8

Closed anki-code closed 4 years ago

anki-code commented 4 years ago

Hi @terrycojones! Following #6

Daudin was really me playing around to see what I could come up with.

Your vision of pipelines and shortcuts around _ look interesting. It will be cool if most of useful approaches not stay just a fun and sometime would be packed as a xontrib for xonsh. It has bigger community and your most greatest ideas would be supported.

Thanks!

UPD: ⭐️ The solution for xonsh — https://github.com/xonsh/xonsh/issues/3366#issuecomment-545673034

reckoner commented 4 years ago

What I personally find most useful about this approach as opposed to xonsh, is that there is far less syntax like $() et. al. that is part of xonsh. Yes, I know that xonsh needs that syntax to be more specific but the fall-through approach here is very clean.

terrycojones commented 4 years ago

Hi @anki-code. Thanks for the suggestion & pointer. I followed the link and read the page. But at the moment I haven't even read the xonsh docs to know how any of what I've done might fit in there.

One thing I wanted to avoid (@reckoner alludes to this) is as much "special" stuff as I could when it could instead just be provided by Python. I added the % special commands a bit reluctantly, and only did it to allow simpler (syntactical) replacements for things that could be done directly in the Python. I think this preference will lead to daudin being more work to use (a bit more awkward) than something like xonsh, which I think must parse the command line (not a bad thing, just something I wanted to try to avoid too) in order to know what to do. So daudin may turn out to be a bit more awkward / convenient to use, all because I like it that it's somehow "clean" (as @reckoner put it). And in any case opinions and usages will surely differ and probably to some extent also just be a matter of taste, etc.

terrycojones commented 4 years ago

Thanks for the xonsh command. I can't say for sure, but I think if I'd thought of doing it that way I probably would have! The way daudin does it is to automatically fall back on the shell, which can result in various weird non-shell text being sent to the shell - not necessarily a good idea! E.g., if you make a typo in a Python command and it can't be eval/exec'd, it will be passed to the shell. With xonsh it seems that could never happen because you need(?) to use $(...) to get something to the shell. Yes, it's more syntax, but it's also safer and "explicit is better than implicit" :-) I think Python has some form of whatis (aka type) command, but that's also problematic if one considers providing access to shells that have functions, aliases, etc. (i.e., things that aren't in $PATH).

terrycojones commented 4 years ago

@anki-code I think I'll close this issue, unless you'd like it left open for some reason?

anki-code commented 4 years ago

Ok, here is we found the lightweight and useful solution for xonsh without daudin xontrib — https://github.com/xonsh/xonsh/issues/3366#issuecomment-545673034

Good luck!

terrycojones commented 4 years ago

Ok, here is we found the lightweight and useful solution for xonsh without daudin xontrib — xonsh/xonsh#3366 (comment)

Good luck!

@anki-code Cool - thanks for the link. That looks nice & simple.