summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/goify/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'krebs/5pkgs/goify/default.nix')
-rw-r--r--krebs/5pkgs/goify/default.nix17
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
+''