from Hacker News

Show HN: Tap curl in your editor before it gets to sh

by awalGarg on 11/13/16, 9:57 AM with 12 comments

  • by robryk on 11/13/16, 3:36 PM

    Why do you create an env variable that contains the whole file in question when the editor returned success? Wouldn't something like:

      cat "$f"; rm "$f"
    
    not involve loading the whole file in memory at once? Note that using this also makes sense with self-extracting archives/shell scripts, because it lets you inspect the shell script at the beginning.
  • by semi-extrinsic on 11/13/16, 2:58 PM

    A much better feature is available in zsh, called safe-paste, that does this without the user having to insert "tap" or anything else manually. It relies on something called bracketed paste, where the terminal emulator sends special escape sequences to indicate the beginning and end of a paste. These are intercepted by the zsh plugin, which opens $EDITOR with the pasted content.

    https://github.com/robbyrussell/oh-my-zsh/blob/master/plugin...

  • by sdx23 on 11/13/16, 3:29 PM

    I don't really see, why I'd install something from some github repository if I can get it from a moreutils package that I like to have installed anyway.
  • by tambourine_man on 11/13/16, 1:08 PM

    Simple, but nice