summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
+''