A collection of fish functions to make my life easier.
Last active
August 9, 2024 19:54
-
-
Save erayerdin/8cec0c7b36b6948a87cbf719253f8f04 to your computer and use it in GitHub Desktop.
My fish functions
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
# add to ~/.config/fish/config.fish | |
function convert_webp_to_gif | |
# Check if ImageMagick is installed | |
if not type -q convert | |
echo "ImageMagick is not installed. Please install it first." | |
return 1 | |
end | |
# Create the backup directory if it doesn't exist | |
set backup_dir webp_backups | |
if not test -d $backup_dir | |
mkdir $backup_dir | |
end | |
# Loop through all .webp files in the current directory | |
for file in *.webp | |
# Check if the file exists | |
if test -e $file | |
# Get the base name without extension | |
set base_name (basename $file .webp) | |
# Convert to GIF | |
convert $file $base_name.gif | |
echo "Converted $file to $base_name.gif" | |
# Move the original .webp file to the backup directory | |
mv $file $backup_dir/ | |
echo "Moved $file to $backup_dir/" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment