macos/furl: route to my new clean-url tool to apply URL cleanups
- ID
be6ecc1- date
2026-09-27 14:28:04+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
234f5e8- message
macos/furl: route to my new clean-url tool to apply URL cleanups- changed files
1 file, 5 additions, 31 deletions
Changed files
macos/furl (1079 → 155)
diff --git a/macos/furl b/macos/furl
index f50c098..12b9a72 100755
--- a/macos/furl
+++ b/macos/furl
@@ -1,33 +1,7 @@
-#!/usr/bin/env osascript
-# Get the URL of the frontmost Safari window.
+#!/usr/bin/env bash
--- An AppleScript function to replace text. Yes, this is really
--- what it takes.
---
--- Example:
---
--- replaceText("The cat is red", "red", "green")
--- /* The cat is green */
---
-on replaceText(inputText, old, new)
- set AppleScript's text item delimiters to the old
- set the itemList to every text item of inputText
- set AppleScript's text item delimiters to the new
- set inputText to the itemList as string
- set AppleScript's text item delimiters to ""
- return inputText
-end replaceText
+set -o errexit
+set -o nounset
-tell application "Safari"
- set frontmostUrl to URL of document 1
-end tell
-
--- Remove the localhost:5959 prefix from my book tracker running
--- locally -- I never actually want this, just the relative path.
-set frontmostUrl to replaceText(frontmostUrl, "http://localhost:5959", "")
-
--- Remove the localhost:5757 prefix from my personal site running
--- locally -- I never actually want this, just the relative path.
-set frontmostUrl to replaceText(frontmostUrl, "http://localhost:5757", "")
-
-get frontmostUrl
+URL=$(osascript -e 'tell application "Safari" to get URL of document 1')
+~/.cargo/bin/clean-url "$URL"