From ab4cad280b8297730be8637edb74e0d3efe4ef4b Mon Sep 17 00:00:00 2001 From: Felix Wang <172729123+felix-windsor@users.noreply.github.com> Date: Thu, 3 Dec 2026 18:54:22 +0800 Subject: [PATCH] diskutil: fix disk image creation options and formats --- src/_diskutil | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/_diskutil b/src/_diskutil index f091a50..44140c5 100644 --- a/src/_diskutil +++ b/src/_diskutil @@ -582,6 +582,14 @@ _diskutil_image_subcommands() { (( $+functions[_diskutil_image_create] )) || _diskutil_image_create() { local ret=1 + local -a common_options=( + '(-e --encrypt)'{-e,--encrypt}'[encrypt the disk image]' + '(-v --verbose)'{-v,--verbose}'[enable verbose output]' + '(--stdinpass --stdinpassphrase)'{--stdinpass,--stdinpassphrase}'[read the passphrase from stdin]' + '--plist[produce output in a plist format]' + '(--volname --volumeName)'{--volname,--volumeName}'[specify the volume name]:volume name:' + '(- *)'{-h,--help}'[show help]' + ) _arguments -C \ '1: :_diskutil_image_create_subcommands' \ @@ -593,16 +601,17 @@ _diskutil_image_create() { case $words[1] in (blank) _arguments \ - '--format[disk format]:format:(RAW ASIF USDB)' \ - '--size[disk size]:size' \ - '--volumeName[volume name]:name' \ - '-fs[create a file system in the specified format]:format:(APFS ExFAT MS-DOS)' \ + "${common_options[@]}" \ + '(-f --format)'{-f,--format}'[disk format]:format:(RAW ASIF UDSB)' \ + '(-s --size)'{-s,--size}'[disk size]:size:' \ + '--fs[create a file system in the specified format]:format:(APFS ExFAT MS-DOS None)' \ '*:: :_files' \ && ret=0 ;; (from) _arguments \ - '--format[disk format]:format:(RAW UDRO UDZO ULFO ULMO ASIF UDSB)' \ + "${common_options[@]}" \ + '(-f --format)'{-f,--format}'[disk format]:format:(RAW UDRO UDZO ULFO ULMO ASIF UDSB)' \ '--shadow[path to the shadow file]:path:_files' \ '*:: :_files' \ && ret=0