2017-05-01 10:19:51 +00:00
|
|
|
{ pkgs, ... }:
|
|
|
|
|
2017-05-02 18:10:36 +00:00
|
|
|
pkgs.writeBashBin "goify" ''
|
2017-05-01 10:19:51 +00:00
|
|
|
set -euf
|
|
|
|
|
|
|
|
GO_HOST=''${GO_HOST:-go}
|
|
|
|
|
|
|
|
while read line; do
|
2017-05-02 18:10:36 +00:00
|
|
|
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'
|
2017-05-01 10:19:51 +00:00
|
|
|
else
|
2017-05-02 18:10:36 +00:00
|
|
|
echo "$word"
|
|
|
|
fi
|
|
|
|
done | grep . | tr '\n' ' '; echo
|
2017-05-01 10:19:51 +00:00
|
|
|
done
|
|
|
|
''
|