Skip to content

Instantly share code, notes, and snippets.

@erayerdin
Last active August 9, 2024 19:54
Show Gist options
  • Save erayerdin/8cec0c7b36b6948a87cbf719253f8f04 to your computer and use it in GitHub Desktop.
Save erayerdin/8cec0c7b36b6948a87cbf719253f8f04 to your computer and use it in GitHub Desktop.
My fish functions

My Fish Functions

A collection of fish functions to make my life easier.

# 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