diff options
Diffstat (limited to 'krebs/5pkgs/simple/goify')
-rw-r--r-- | krebs/5pkgs/simple/goify/default.nix | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/krebs/5pkgs/simple/goify/default.nix b/krebs/5pkgs/simple/goify/default.nix new file mode 100644 index 000000000..9c44aaeeb --- /dev/null +++ b/krebs/5pkgs/simple/goify/default.nix @@ -0,0 +1,18 @@ +{ pkgs, ... }: + +pkgs.writeBashBin "goify" '' + set -euf + + GO_HOST=''${GO_HOST:-go} + + while read line; do + echo "$line" | sed 's|https\?://\S*|\n&\n|g' | while read word; do + if echo "$word" | grep -q '^https\?:'; then + ${pkgs.curl}/bin/curl -Ss -F uri="$word" http://"$GO_HOST" \ + | tr -d '\r' + else + echo "$word" + fi + done | grep . | tr '\n' ' '; echo + done +'' |