Last active
February 1, 2025 23:27
-
-
Save nikitavoloboev/23759c3eebedbe05b1679a4ea05b8d6f to your computer and use it in GitHub Desktop.
fetch a site into ~/sites/<website>.txt with https://github.com/egoist/sitefetch. as seen on https://x.com/nikitavoloboev/status/1885825497084657693
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sf | |
if test -z "$argv[1]" | |
echo "Usage: sf <url>" | |
return 1 | |
end | |
# Extract domain from URL (remove protocol if present and path) | |
set domain (echo $argv[1] | sed -E 's|^https?://||' | cut -d'/' -f1) | |
# Create filename from domain | |
set filename "$HOME/sites/$domain.txt" | |
# Check if URL already starts with http(s):// | |
if string match -q 'http*://*' $argv[1] | |
sitefetch "$argv[1]" -o $filename | |
else | |
sitefetch "https://$argv[1]" -o $filename | |
end | |
# Copy content to clipboard | |
cat $filename | pbcopy | |
echo "Saved to $filename (content copied to clipboard)" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment