Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This looks really neat. The demo uses a lot of shell pipes though, needing to type "pastel" out for every processing step. It would be convenient if something like

  pastel random | pastel mix red | pastel lighten 0.2 | pastel format hex
could be written

  pastel random mix red lighten 0.2 format hex
(not quite possible, I think) or

  pastel random then mix red then lighten 0.2 then format hex
or something.


GStreamer uses the argument "!" as a pseudo-"|" so you can build multimedia pipelines without actually using Unix pipelines, or repeating the gst-launch command:

https://gstreamer.freedesktop.org/documentation/tutorials/ba...


Having written a large number of CLIs in the past, I've often come across this issue but never had a good solution. This is remarkably simple, elegant, and easily generalized into a CLI framework so it can be implemented with ease. Thank you for sharing this nugget of gold!


Sadly Zsh uses ! for history expansion so they'd all have to be escaped in that shell.


Even in the middle of a line, not just at the start?


Yes, and it's a great feature IMO:

    touch projects/new-lib/readme
    cd !!:1:h


That would be great.

  pastel random ! mix red ! lighten 0.2 ! format hex



Every shell can make its own version, but here's a wrapper in fish which I named pstl:

  eval (echo "pastel $argv" | sed 's/ | / | pastel /g')
Now you can

  pstl "random | mix red | lighten 0.2 | format hex"




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: