diff options
author | makefu <github@syntax-fehler.de> | 2017-05-02 09:44:08 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2017-05-02 09:44:08 +0200 |
commit | f1b266e05c61710a0b4b657f5916ac84d579e358 (patch) | |
tree | 432633b6b2c5f27102ffa46b38d915af9983ec7e /krebs/5pkgs/goify/default.nix | |
parent | cc8efe15822d15d0cb4315b0d0c308474ef3343f (diff) | |
parent | d18c4022d277dd45ffc388b8f3868a42ab9592ad (diff) |
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'krebs/5pkgs/goify/default.nix')
-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 +'' |