Skip to content

New completion for ImageMagick 7 (magick command)#165

Open
robbyrob42 wants to merge 1 commit intozsh-users:masterfrom
robbyrob42:add-magick-completion
Open

New completion for ImageMagick 7 (magick command)#165
robbyrob42 wants to merge 1 commit intozsh-users:masterfrom
robbyrob42:add-magick-completion

Conversation

@robbyrob42
Copy link
Copy Markdown

ImageMagick 7 unified all tools under a single magick command, replacing the standalone binaries from IM6 (convert, identify, mogrify, etc.). The existing _imagemagick completion covers IM6 but has no support for the magick command or IM7's option set.

This adds _magick which:

  • Completes magick and all legacy tool names via #compdef
  • Dispatches magick <tool> subcommands (identify, compare, etc.) to tool-specific option sets
  • Handles bare magick [options...] input output (convert-style) usage
  • Completes enum values for colorspace, compose, compress, filter, gravity, metric, morphology, distort, evaluate, layers, and more — all sourced from magick -help and magick -list output
  • Filters file completion to common image formats with fallback to all files
  • Uses _pick_variant to detect IM7 and falls back to _files on IM6, so it coexists safely with _imagemagick
  • Supports _call_function hooks for user-overridable subcommand completions

Tested against ImageMagick 7.1.2-17 on macOS (Homebrew). Follows the completion style guide conventions.

Note: _imagemagick and _magick both register #compdef for 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 _imagemagick to defer to _magick when IM7 is detected, or deprecating _imagemagick in favor of this file.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant