New completion for ImageMagick 7 (magick command)#165
Conversation
Add _magick completion for ImageMagick 7.1, which unifies all tools under the `magick` command. This completes alongside the existing _imagemagick which covers ImageMagick 6. Features: - Completes magick and all legacy tool names (convert, identify, mogrify, composite, compare, montage, stream, display, animate, import, conjure) - Subcommand dispatch: `magick identify`, `magick compare`, etc. each get tool-specific options - Bare `magick` usage (convert-style) gets the full option set - Enum value completion for colorspace, compose, compress, filter, gravity, metric, morphology, distort, evaluate, and more - File completion filtered to common image formats with fallback - Version guard via _pick_variant: falls back to _files on IM6 so it coexists safely with _imagemagick - _call_function hooks for user-overridable subcommand completions
|
our normal policy is to just target the latest version for completion functions. i guess imagemagick is like a python 2->3 thing though where people have stayed on 6 for years and years. debian didn't even package im7 until trixie. so. idk i don't have time/energy to do a full review of this atm but spot-checking the options, it looks like there's still a tonne of overlap with im6. we also have a _graphicsmagick that seems largely identical. i'm sure it's not perfect, but do you reckon it's close enough that your function could just replace those two entirely (with some minor changes like supporting |
|
Our naming convention is that a completion for, e.g. imagemagick is called It'd be easier to review this, if it was based on the old function because we now need to check whether any old functionality that would still be applicable is being lost. I wouldn't bother checking for ImageMagick 6 at the top, Just complete 7 options and if there are a few extra then so-be-it. That's more useful than degrading to just file completion. |
|
appreciate the feedback, i'll iterate and come back |
ImageMagick 7 unified all tools under a single
magickcommand, replacing the standalone binaries from IM6 (convert, identify, mogrify, etc.). The existing_imagemagickcompletion covers IM6 but has no support for themagickcommand or IM7's option set.This adds
_magickwhich:magickand all legacy tool names via#compdefmagick <tool>subcommands (identify, compare, etc.) to tool-specific option setsmagick [options...] input output(convert-style) usagemagick -helpandmagick -listoutput_pick_variantto detect IM7 and falls back to_fileson IM6, so it coexists safely with_imagemagick_call_functionhooks for user-overridable subcommand completionsTested against ImageMagick 7.1.2-17 on macOS (Homebrew). Follows the completion style guide conventions.
Note:
_imagemagickand_magickboth register#compdeffor the legacy binary names (convert, identify, etc.). On systems with IM7, the zsh maintainers may want to decide how to handle the overlap — e.g., updating_imagemagickto defer to_magickwhen IM7 is detected, or deprecating_imagemagickin favor of this file.