fish: Add epub2pdf function

This is part of migrating scripts from ~/.local/bin to the nix-config.
Note that this also lets us use packages that aren't available in a
user's $PATH.
This commit is contained in:
Donovan Glover 2024-05-27 23:33:17 -04:00
parent c40055a515
commit 2fbad70214
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65

View File

@ -1,3 +1,5 @@
{ pkgs, ... }:
{
programs.fish = {
enable = true;
@ -157,6 +159,15 @@
echo "Done. Reduced file size from $ORIGINAL_SIZE to $NEW_SIZE"
'';
epub2pdf = /* fish */ ''
if string match -qe -- ".epub" "$argv";
set BASE (string split -f 1 ".epub" "$argv")
${pkgs.calibre}/bin/ebook-convert "$argv" "$BASE.pdf"; and trash "$argv"
else
echo "Usage: epub2pdf [file.epub]"
end
'';
};
};
}