diff options
author | lassulus <lass@lassul.us> | 2017-05-01 12:19:51 +0200 |
---|---|---|
committer | lassulus <lass@lassul.us> | 2017-05-01 12:19:51 +0200 |
commit | d18c4022d277dd45ffc388b8f3868a42ab9592ad (patch) | |
tree | bc201948b0d7eb75a58e70393bcfb4697b16d769 | |
parent | b528ace23e6540ae9039c95289fe47bd8995756f (diff) |
goify: init
-rw-r--r-- | krebs/5pkgs/goify/default.nix | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/krebs/5pkgs/goify/default.nix b/krebs/5pkgs/goify/default.nix new file mode 100644 index 000000000..e2849b5c7 --- /dev/null +++ b/krebs/5pkgs/goify/default.nix @@ -0,0 +1,17 @@ +{ pkgs, ... }: + +pkgs.writeDashBin "goify" '' + set -euf + + GO_HOST=''${GO_HOST:-go} + + while read line; do + echo "$line" | sed -E 's|https?://\S*|\n&\n|g' | while read word; do + if echo "$word" | grep -Eq ^https?:; then + ${pkgs.curl}/bin/curl -Ss -F uri="$word" http://"$GO_HOST" | tr -d '\r' + else + echo "$word"; + fi; + done | sed '/^$/d' | tr '\n' ' '; echo; + done +'' |