8/6/2023 0 Comments Xonsh save output![]() For example, Marcel is going to return Python data types for things when I really just want shell scripting, but easier from Python. I mostly just want a library that makes shelling out easier. Marcel and Xonsh are doing way more than I want. Here are my thoughts from my hacking last night: Maybe someday I’ll stumble upon the ``right way’’ to implement a shell language, but for now bash is just fine. pysh’s approach is to modify the syntax of python resulting in an uglier, and confusing, language. I no longer believe this approach to shell scripting to be a good solution. I think Eggex makes more sense because it’s embedded in a shell language and it’s not a Python library.Īlso clicking through the wiki, I just noticed this from the author of “pysh”: Again ironically I learned every nook and cranny of Python and POSIX regex syntax by writing it. But when I went back to use it, it was easier to just suck it up and use Python/Perl regex syntax. Similarly there was a predecessor to Eggex in Python called Annex. (Deployment was an issue for sure.) I learned enough shell by writing them that I lacked the motivation to actually use them for “production” problems :) I would generally like my Python-based tools, but then when I go back to use them, it was often easier to just do it in shell. To me it feels like each one is a little wrong for some job, so someone writes a new one. It’s probably useful for some problems, but I would still point to the lack of convergence as a curious thing. But I think that approach is fundamentally limited – hence the long-winded Oil project :) I even got some positive comments from Guido van Rossum about it. But I could be wrong.įWIW I have written similar shell-ish Python tools going back 15 years now – one was called “dice” and used JSON over pipes. It feels like there’s a bit too much re-inventing the wheel here, even just within Python. This meant you didn’t have to wait for the conversion to finish to start playing, and even my little Atom server was more than fast enough to convert this on the fly.ĭefinitely write up the results! I think many would find it useful. When I wrote my web-based music player years ago this is how converting audio files worked: the flac -d would decompress to stdout, which was connected to oggenc, and the stdout of that got streamed to Firefox. This also means it won’t have to use the shell and all the problems that introduces, since you can start the git log process with the stdout connected to a new grep process’s stdin. For example, shell commands typically work on lines, instead of just returning a string, returning a (with a generator for bonus points) would be better, or even a subclass of list with some added methods for convenience, so you can do stuff like ~"git log".grep('foo'). It’s also a bit of a missed opportunity IMO, as right now it’s just a syntax wrapper but you can do so much more. There’s also no support for escaping anything in the shell command. So that ~ works by patching the ast not entirely sure how I feel about that. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |