top | item 37626110

(no title)

elesiuta | 2 years ago

I have never heard of pyp before, looks neat!

I made something similar myself, pyxargs [1], which doesn't have all the magic of pyp, but although being geared towards more xargs like usage, it also functions somewhat similarly.

For example, although not as clean as the magic variables x, l or line, you can use '{}'

  ls | pyp 'x[:3]'  ==  ls | pyxargs --pyev "'{}'[:3]"
Overall the syntax of pyp looks much better, and the --explain feature is nice since pyp seems to do a little more for you under the hood (the closest pyxargs equivalent being --dry-run). I think I'll start using pyp myself when not running commands over multiple directories of files or in parallel.

[1] https://github.com/elesiuta/pyxargs

discuss

order

throwaway290|2 years ago

I like your take on it compared to pyp at first glance because it uses a clearer API (xargs instead of just wildcard pipe) and a more appropriate name (pypyp is nonsense) even if it has fewer features.

But yeah I didn't know either existed and I wish I did, seems like it could be really useful in the shell

elesiuta|2 years ago

Thank you! My original use case was for running ffmpeg in directories with encodings that broke xargs, and later added the py/pyev flags which basically swapped subprocess.run() with exec()/print(eval()).

I didn't really highlight it in the documentation but it can also run commands in parallel as multiple windows in a multiplexer so it's easier to checkup on their progress or interact with them.