Created
February 19, 2019 16:55
-
-
Save saterus/4aa57a29cf8e1e363f96d8c1262b7b20 to your computer and use it in GitHub Desktop.
This file contains 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 giphy | |
set filename "$argv[1]" | |
set full_path "$HOME/Downloads/$filename" | |
if test -n "$argv[2]" | |
set url "$argv[2]" | |
else | |
set url (pbpaste) | |
end | |
curl \ | |
# --verbose \ | |
--silent \ | |
-H "Content-Type: image/gif" \ | |
-H "Accept: image/gif" \ | |
-o "$full_path" \ | |
--url "$url" | |
if test $status -eq 0 | |
echo "Saved $full_path" | |
else | |
echo "Something went wrong! $status" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment