1#compdef hdiutil
2
3# utilities
4#
5_hdiutil_disk() {
6  local -a disk_desc
7  _call_program devices hdiutil info | while read; do
8    local disk_name="${${(M)REPLY[(w)1]%/dev/disk*}#/dev/}"
9    if (( #disk_name )); then
10      disk_desc+=( "$disk_name:${${(M)REPLY%	*}#?}" )
11    fi
12  done
13  _describe -t devices disks disk_desc
14}
15
16_hdiutil_device() {
17  local -a device_desc
18  _call_program devices /usr/bin/hdiutil burn -list | while read; do
19    if [[ "$REPLY" == [:space:]#IOService:* ]]; then
20      device_desc+=( "$REPLY" )
21    fi
22  done
23  local expl
24  _wanted devices expl device compadd "$device_desc[@]"
25}
26
27_hdiutil_imagesize(){
28  local -a arr
29  local num="${PREFIX%%[^0-9]*}"
30  if [[ -n "$num" ]]; then
31    arr=(
32      "$num"b:"$(($num / 2.**11)) mega bytes"
33      "$num"k:"$(($num / 2.**10)) mega bytes"
34      "$num"m:"$(($num)) mega bytes"
35      "$num"g:"$(($num)) giga bytes"
36      "$num"t:"$(($num * 2**10)) giga bytes"
37      "$num"p:"$(($num * 2**20)) giga bytes"
38      "$num"e:"$(($num * 2**30)) giga bytes"
39    )
40
41    local expl
42    _describe -t values "size (b, k, m, g..)" arr -V1
43  else
44    _message "size (b, k, m, g..)"
45  fi
46}
47
48_hdiutil_imageformat(){
49  local -a fmts
50  fmts=(
51    "UDRW:UDIF read/write image"
52    "UDRO:UDIF read-only image"
53    "UDZO:UDIF zlib-compressed image"
54    "UDCO:UDIF ADC-compressed image"
55    "UFBI:UDIF entire image with MD5 checksum"
56    "UDTO:DVD/CD-R master for export"
57    "UDxx:UDIF stub image"
58    "UDSP:SPARSE (growable with content)"
59    "Rdxx:NDIF read-only image (Disk Copy 6.3.3 format)"
60    "DC42:Disk Copy 4.2 image"
61  )
62  ofmts=(
63    "UDRo:UDIF read-only"
64    "UDCo:UDIF compressed"
65    "RdWr:NDIF read/write image"
66    "ROCo:NDIF compressed image"
67    "Rken:NDIF compressed"
68  )
69  _describe -t types "image format" fmts -V1 ||
70  _describe -t types "obsolete/deprecated image format" ofmts -V1
71}
72
73_hdiutil(){
74  local -a _common_options
75  _common_options=(
76    '(: -)'-help'[display help message of a verb]'
77    '(-quiet)-verbose' '(-verbose debug)-quiet' '(-quiet)-debug'
78  )
79
80  local -A _common_usage_options
81  _common_usage_options=(
82    -shadow "-shadow:shadow file:_files -g '*.shadow(-.)'"
83    -encryption "-encryption:encryption method:(CEncryptedEncoding)"
84    -stdinpass "-stdinpass[specify password from standard input]"
85    -certificate "-certificate[secondary access certificate]:certificate file:_files"
86    -cacert "-cacert[certificate authority certificate]: :_files"
87    -imagekey "*-imagekey[image key]: :->keyvalue"
88    -srcimagekey "*-srcimagekey[source image key]: :->keyvalue"
89    -tgtimagekey "*-tgtimagekey[target image key]: :->keyvalue"
90    -insecurehttp "-insecurehttp[ignore SSL host validation failure]"
91    -plist "-plist[display output in plist format]"
92    -recover "-recover[keychain to unlock]:keychain file:_files -g '*.keychain(-.)'"
93  )
94
95  local -a _1st_arguments
96  _1st_arguments=(
97    'help:display minimal usage information'
98    'attach:attach a disk image'
99    'mount:attach a disk image'
100    'detach:detach a disk image'
101    'eject:detach a disk image'
102    'verify:verify the checksum of a disk image'
103    'create:create a disk image'
104    'convert:convert a disk image into another format'
105    'burn:burn image to optical media'
106    'makehybrid:generate cross-platform hybrid images'
107    'compact:compacts a SPARSE disk image'
108    'info:display information about the disk image driver and attached images'
109    'load:manually load the disk image driver'
110    'checksum:calculate the specified checksum on the image data'
111    'chpass:change the passphrase for an encrypted image'
112    'unflatten:extract any UDIF metadata into resource fork'
113    'flatten:embed any resource fork into UDIF data fork'
114    'hfsanalyze:print information about an HFS/HFS+ volume'
115    'mountvol:mount a volume'
116    'unmount:unmount a volume'
117    'imageinfo:print out information about a disk image'
118    'plugins:print information about DiskImages framework plugins'
119    'internet-enable:enable or disable post-processing for the image'
120    'resize:resize partition or image'
121    'segment:segment disk image'
122    'pmap:display the partition map'
123  )
124
125  local size_spec='-size -sectors -megabytes -srcfolder -srcdir'
126
127  #
128  local curcontext="$curcontext" state line expl
129  local -A opt_args
130
131  _arguments -C '*:: :->subcmds'
132
133  if (( CURRENT == 1 )); then
134    _describe -t commands "hdiutil subcommands" _1st_arguments
135    return
136  fi
137
138  case "$words[1]" in
139    attach|mount)
140      _arguments \
141        "$_common_options[@]" \
142        "$_common_usage_options[-encryption]" \
143        "$_common_usage_options[-stdinpass]" \
144        "$_common_usage_options[-imagekey]" \
145        "$_common_usage_options[-srcimagekey]" \
146        "$_common_usage_options[-plist]" \
147        "$_common_usage_options[-shadow]" \
148        "$_common_usage_options[-insecurehttp]" \
149        "$_common_usage_options[-cacert]" \
150        "$_common_usage_options[-recover]" \
151        "(-readwrite)-readonly[force the resulting device to be read-only]" \
152        "(-readonly)-readwrite[attempt to set the device to be read/write]" \
153        "(-nokernel)-nokernel[attach with/without a helper process]" \
154        "(-kernel)-kernel[attach with/without a helper process]" \
155        "-notremovable[prevent this image from being detached]" \
156        "(-nomount)-mount[indicate whether image should be mounted]:mount?:(required optional suppressed)" \
157        "(-mount)-nomount[indicate whether image should be mounted]" \
158        "-mountroot[mount volumes in specified path]: :_directories" \
159        "-mountpoint[mount volume at specified path]: :_directories" \
160        "-union[perform a union mount]" \
161        "-private[suppress mount notifications to the rest of the system]" \
162        "-nobrowse[mark the volumes non-browsable in applications]" \
163        "-owners[enable or disable owners for HFS+ volumes]: :(on off)" \
164        "*-drivekey[key/value pair in the IOKit registry]:key=value:" \
165        "(-noverify)-verify[verify image checksums]" \
166        "(-verify)-noverify" \
167        "(-noignorebadchecksums)-ignorebadchecksums[indicate bad checksums should be ignored]" \
168        "(-ignorebadchecksums)-noignorebadchecksums" \
169        "(-noidme)-idme[perform IDME actions]" \
170        "(-idme)-noidme" \
171        "(-noidmereveal)-idmereveal[reveal the results of IDME processing]" \
172        "(-idmereveal)-noidmereveal" \
173        "(-noidmetrash)-idmetrash[put IDME images in the trash after processing]" \
174        "(-idmetrash)-noidmetrash" \
175        "(-noautoopen)-autoopen[auto-open volumes after attaching an image]" \
176        "(-autoopen)-noautoopen" \
177        "(-noautoopenro)-autoopenro[auto-open read-only volumes]" \
178        "(-autoopenro)-noautoopenro" \
179        "(-noautoopenrw)-autoopenrw[auto-open read/write volumes]" \
180        "(-autoopenrw)-noautoopenrw" \
181        "1:disk image to attach:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
182        && return 0
183      ;;
184    detach|eject)
185      _arguments \
186        "$_common_options[@]" \
187        "-force[unmount any filesystems and detaches the image]" \
188        "1: :_hdiutil_disk" && return 0
189      ;;
190    verify)
191      _arguments \
192        "$_common_options[@]" \
193        "$_common_usage_options[-encryption]" \
194        "$_common_usage_options[-stdinpass]" \
195        "$_common_usage_options[-imagekey]" \
196        "$_common_usage_options[-srcimagekey]" \
197        "$_common_usage_options[-plist]" \
198        "1:disk image to verify:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
199        && return 0
200      ;;
201    create)
202      local fold_opts="-format -crossdev -nocrossdev -scrub -noscrub"
203      _arguments \
204        "$_common_options[@]" \
205        "$_common_usage_options[-encryption]" \
206        "$_common_usage_options[-stdinpass]" \
207        "$_common_usage_options[-imagekey]:" \
208        "$_common_usage_options[-srcimagekey]" \
209        "$_common_usage_options[-tgtimagekey]" \
210        "$_common_usage_options[-plist]" \
211        "($size_spec $fold_opts)-size[specify size]: :_hdiutil_imagesize" \
212        "($size_spec $fold_opts)-sectors[specify size]:512 byte sectors" \
213        "($size_spec $fold_opts)-megabytes[specify size]:mega bytes" \
214        "($size_spec)-srcfolder[specify directory]: :_directories" \
215        "($size_spec)-srcdir[specify directory]: :_directories" \
216        "-align[size to which partition is aligned]:size" \
217        "-type[image type]:image type:(UDIF SPARSE)" \
218        "-fs[filesystem to make]:filesystem:(HFS+ HFS+J HFSX HFS MS-DOS UFS)" \
219        "-volname[volume name]:name" \
220        "-uid[uid of root directory]:uid in number" \
221        "-gid[gid of root directory]:gid in number" \
222        "-mode[mode of root directory]:mode" \
223        "-nouuid[suppress adding a UUID]" \
224        "(-noautostretch)-autostretch" \
225        "(-autostretch)-noautostretch" \
226        "-stretch[max_stretch]: :_hdiutil_imagesize" \
227        "-fsargs[additional arguments to pass to newfs]:arguments" \
228        "-layout[partition layout]:partition layout:(NONE SPUD UNIVERSAL\ CD UNIVERSAL\ HD)" \
229        "-partitionType[partition type]:partition type:(Apple_HFS Apple_UFS)" \
230        "-ov[overwrite an existing file]" \
231        "-attach[attach the image after creating it]" \
232        "-format:format:_hdiutil_imageformat" \
233        "(-nocrossdev)-crossdev[cross device boundaries when copying from the source]" \
234        "(-crossdev)-nocrossdev" \
235        "(-noscrub)-scrub[skip temporary files and trashes]" \
236        "(-scrub)-noscrub" \
237        "(-noanyowners)-anyowners[allow user files being copied]" \
238        "(-anyowners)-noanyowners" \
239        "1:disk image to create:_files" && return 0
240
241      if [[ $state = keyvalue ]]; then
242        _values 'key=value' \
243          "di-sparse-puma-compatible: :(TRUE FALSE)" \
244          "di-shadow-puma-compatible: :(TRUE FALSE)" \
245          "encrypted-encoding-version:version:(1 2)" \
246          "zlib-level:compression level:(1 2 3 4 5 6 7 8 9)" && return 0
247      fi
248      ;;
249    convert)
250      _arguments \
251        "$_common_options[@]" \
252        "$_common_usage_options[-encryption]" \
253        "$_common_usage_options[-stdinpass]" \
254        "$_common_usage_options[-certificate]" \
255        "$_common_usage_options[-srcimagekey]" \
256        "$_common_usage_options[-tgtimagekey]" \
257        "$_common_usage_options[-shadow]" \
258        "$_common_usage_options[-insecurehttp]" \
259        "$_common_usage_options[-cacert]" \
260        "$_common_usage_options[-plist]" \
261        "-align:size (512 byte sectors)" \
262        "-segmentSize: :_hdiutil_imagesize" \
263        "-pmap[add partition map]" \
264        "-tasks[number of tasks for compression operation]:number:" \
265        "-ov[overwrite an existing file]" \
266        "-format:format:_hdiutil_imageformat" \
267        "-o:target disk image:_files" \
268        "1:source disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
269        && return 0
270
271      if [[ $state = keyvalue ]]; then
272        _values 'key=value' \
273          "zlib-level:compression level:(1 2 3 4 5 6 7 8 9)" && return 0
274      fi
275      ;;
276    burn)
277      _arguments \
278        "$_common_options[@]" \
279        "$_common_usage_options[-shadow]" \
280        "$_common_usage_options[-insecurehttp]" \
281        "$_common_usage_options[-cacert]" \
282        "$_common_usage_options[-srcimagekey]" \
283        "$_common_usage_options[-encryption]" \
284        "$_common_usage_options[-stdinpass]" \
285        "-device[device to use for burning]:device:_hdiutil_device" \
286        "-testburn[don\'t turn on laser]" \
287        "-anydevice[allow burning to devices not qualified by Apple]" \
288        "(-eject)-noeject[don\'t eject disc after burning]" \
289        "(-noeject)-eject" \
290        "(-verifyburn)-noverifyburn[don\'t verify disc contents after burn]" \
291        "(-noverifyburn)-verifyburn" \
292        "(-addpmap)-noaddpmap[don\'t add partition map]" \
293        "(-noaddpmap)-addpmap" \
294        "(-skipfinalfree)-noskipfinalfree[don\'t skip final free partition]" \
295        "(-noskipfinalfree)-skipfinalfree" \
296        "(-nooptimizeimage)-optimizeimage[optimize filesystem for burning]" \
297        "(-optimizeimage)-nooptimizeimage" \
298        "-nounderrun[turn off buffer underrun protection]" \
299        "-forceclose[force the disc to be closed after burning]" \
300        "-speed[desired \"x-factor\"]:x_factor:(1 2 4 6 max)" \
301        "-sizequery[calculate the required size without burning anything]" \
302        "-erase[erase the media]" \
303        "-fullerase[erase all sectors of the disc]" \
304        "-list[list all burning devices with paths suitable for -device]" \
305        "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
306        && return 0
307      ;;
308    makehybrid)
309      _arguments \
310        "$_common_options[@]" \
311        "$_common_usage_options[-encryption]" \
312        "$_common_usage_options[-stdinpass]" \
313        "$_common_usage_options[-shadow]" \
314        "$_common_usage_options[-insecurehttp]" \
315        "$_common_usage_options[-cacert]" \
316        "-hfs[generate an HFS+ filesystem]" \
317        "-iso[generate an ISO9660 filesystem with Rock Ridge extensions]" \
318        "-joliet[generate Joliet extensions to ISO9660]" \
319        "-hfs-blessed-directory[blessed folder for booting Mac OS X]: :_directories" \
320        "-hfs-openfolder[folder automatically opened]: :_directories" \
321        "-hfs-startupfile-size[Startup File size]:bytes" \
322        "-abstract-file[path to an ISO9660/Joliet Abstract file]: :_file" \
323        "-bibliography-file[path to a ISO9660/Joliet Bibliography file]: :_file" \
324        "-copyright-file[path to a ISO9660/Joliet Copyright file]: :_file" \
325        "-application[creator application name]:creator name" \
326        "-preparer[data preparer name]:preparer name" \
327        "-publisher[publisher name]:publisher name" \
328        "-system-id[system identifier]:system identifier" \
329        "-keep-mac-specific[keep Macintosh-specific files in non-HFS+ filesystems]" \
330        "-default-volume-name[default volume name for all filesystems]:name" \
331        "-hfs-volume-name[volume name for HFS+ filesystem]:name" \
332        "-iso-volume-name[volume name for ISO9660 filesystem]:name" \
333        "-joliet-volume-name[volume name for Joliet]:name" \
334        "-hide-all[glob expression to hide]:glob expression" \
335        "-hide-hfs[glob expression to hide in HFS+]:glob expression" \
336        "-hide-iso[glob expression to hide in ISO9660]:glob expression" \
337        "-hide-joliet[glob expression to hide in Joliet]:glob expression" \
338        "-print-size[print size estimate and quit]" \
339        "-plistin[accept command-line options as a plist on stdin]" \
340        "-ov[overwrite an existing file]" \
341        "(-noverify)-verify[verify image checksums]" \
342        "(-verify)-noverify" \
343        "(-nokernel)-nokernel[attach with a helper process]" \
344        "(-kernel)-kernel[attach without a helper process]" \
345        "-o:target disk image:_files" \
346        "1:source disk image or directory:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
347        && return 0
348      ;;
349    compact)
350      _arguments \
351        "$_common_options[@]" \
352        "$_common_usage_options[-encryption]" \
353        "$_common_usage_options[-stdinpass]" \
354        "$_common_usage_options[-srcimagekey]" \
355        "$_common_usage_options[-shadow]" \
356        "$_common_usage_options[-insecurehttp]" \
357        "$_common_usage_options[-cacert]" \
358        "$_common_usage_options[-plist]" \
359        "1:sparse image:_files -g '*.sparseimage(-.)'" && return 0
360      ;;
361    info)
362      _arguments "$_common_options[@]" \
363        "$_common_usage_options[-plist]" && return 0
364      ;;
365    load)
366      _arguments "$_common_options[@]" && return 0
367      ;;
368    checksum)
369      _arguments \
370        "$_common_options[@]" \
371        "$_common_usage_options[-encryption]" \
372        "$_common_usage_options[-stdinpass]" \
373        "$_common_usage_options[-srcimagekey]" \
374        "$_common_usage_options[-shadow]" \
375        "$_common_usage_options[-insecurehttp]" \
376        "$_common_usage_options[-cacert]" \
377        "$_common_usage_options[-plist]" \
378        "-type:image type:(UDIF-CRC32 UDIF-MD5 DC42 CRC28 CRC32 MD5)" \
379        "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
380        && return 0
381      ;;
382    chpass)
383      _arguments \
384        "$_common_options[@]" \
385        "$_common_usage_options[-recover]" \
386        "$_common_usage_options[-srcimagekey]" \
387        "-oldstdinpass[specify old password from standard input]" \
388        "-newstdinpass[specify new password from standard input]" \
389        "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
390        && return 0
391      ;;
392    unflatten)
393      _arguments \
394        "$_common_options[@]" \
395        "$_common_usage_options[-encryption]" \
396        "$_common_usage_options[-stdinpass]" \
397        "$_common_usage_options[-srcimagekey]" \
398        "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
399        && return 0
400      ;;
401    flatten)
402      _arguments \
403        "$_common_options[@]" \
404        "$_common_usage_options[-encryption]" \
405        "$_common_usage_options[-stdinpass]" \
406        "$_common_usage_options[-srcimagekey]" \
407        "(-xml)-noxml[don\'t embed XML data for in-kernel attachment]" \
408        "(-noxml)-xml" \
409        "(-rsrcfork)-norsrcfork[don\'t embed resource fork data]" \
410        "(-norsrcfork)-rsrcfork" \
411        "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
412        && return 0
413      ;;
414    hfsanalyze)
415      _arguments \
416        "$_common_options[@]" \
417        "$_common_usage_options[-encryption]" \
418        "$_common_usage_options[-stdinpass]" \
419        "$_common_usage_options[-srcimagekey]" \
420        "$_common_usage_options[-shadow]" \
421        "$_common_usage_options[-insecurehttp]" \
422        "$_common_usage_options[-cacert]" \
423        "1:disk image or device:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
424        && return 0
425      ;;
426    mountvol)
427      _arguments \
428        "$_common_options[@]" \
429        "$_common_usage_options[-plist]" \
430        "1: :_path_files -W /dev -g disk\*" && return 0
431      ;;
432    unmount)
433      _arguments \
434        "$_common_options[@]" \
435        "-force[unmount filesystem regardless of open files]" \
436        "1:device or mount point:_files" && return 0
437      ;;
438    imageinfo)
439      _arguments \
440        "$_common_options[@]" \
441        "$_common_usage_options[-encryption]" \
442        "$_common_usage_options[-stdinpass]" \
443        "$_common_usage_options[-srcimagekey]" \
444        "$_common_usage_options[-shadow]" \
445        "$_common_usage_options[-insecurehttp]" \
446        "$_common_usage_options[-cacert]" \
447        "$_common_usage_options[-plist]" \
448        "-format[just print out the image format]" \
449        "-checksum[just print out the image checksum]" \
450        "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
451        && return 0
452      ;;
453    plugins)
454      _arguments \
455        "$_common_options[@]" "$_common_usage_options[-plist]" && return 0
456      ;;
457    internet-enable)
458      _arguments \
459        "$_common_options[@]" \
460        "$_common_usage_options[-encryption]" \
461        "$_common_usage_options[-stdinpass]" \
462        "$_common_usage_options[-srcimagekey]" \
463        "$_common_usage_options[-plist]" \
464        "(-yes -no -query)"{-yes,-no,-query} \
465        "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
466        && return 0
467      ;;
468
469    resize)
470      _arguments -C \
471        "$_common_options[@]" \
472        "$_common_usage_options[-encryption]" \
473        "$_common_usage_options[-stdinpass]" \
474        "$_common_usage_options[-srcimagekey]" \
475        "$_common_usage_options[-shadow]" \
476        "$_common_usage_options[-insecurehttp]" \
477        "$_common_usage_options[-cacert]" \
478        "$_common_usage_options[-plist]" \
479        "(-sectors)-size[specify size]: :_hdiutil_imagesize" \
480        "(-size)-sectors[specify size]:size (512 byte sectors)/min/max:" \
481        "-imageonly[only resize image file]" \
482        "-partitiononly[only resize partition(s) in the image]" \
483        "-partitionNumber[partition to resize]:partition number" \
484        "-growonly[only allow the image to grow]" \
485        "-shrinkonly[only allow the image to shrink]" \
486        "-nofinalgap[allow elimination of trailing free partition]" \
487        "-limits[displays min/current/max size]" \
488        "1:disk image:_files -g \*.dmg\(\|.bin\)\(-.\)" \
489        && return 0
490      ;;
491    segment)
492      _arguments \
493        "$_common_options[@]" \
494        "$_common_usage_options[-encryption]" \
495        "$_common_usage_options[-stdinpass]" \
496        "$_common_usage_options[-srcimagekey]" \
497        "$_common_usage_options[-tgtimagekey]" \
498        "$_common_usage_options[-plist]" \
499        "(-segmentSize)-segmentCount[number of segments]:number" \
500        "(-segmentCount)-segmentSize[segment size]: :_hdiutil_imagesize" \
501        "-firstSegmentSize[first segment size]: :_hdiutil_imagesize" \
502        "-restricted[make restricted segments]" \
503        "-o[first segment name]:name" \
504        "1:source disk image:_files -g \*.dmg\(\|.bin\)\(-.\)" \
505        && return 0
506      ;;
507    pmap)
508      _arguments \
509        "$_common_options[@]" \
510        "$_common_usage_options[-encryption]" \
511        "$_common_usage_options[-stdinpass]" \
512        "$_common_usage_options[-srcimagekey]" \
513        "$_common_usage_options[-shadow]" \
514        "$_common_usage_options[-insecurehttp]" \
515        "$_common_usage_options[-cacert]" \
516        "-options[just print out the image checksum]: :->option" \
517        "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
518        && return 0
519
520      case "$state" in
521        option)
522          _values -s '' option \
523            "r[process all without modification]" \
524            "x[process 2K & 512 entries and merge]" \
525            "s[return all quantities in sectors]" \
526            "S[sort all entries by block number]" \
527            "g[account for all unmapped space]" \
528            "c[combine adjacent freespace entries]" \
529            "f[extend last partition to device end]" \
530            "v[synthesize single volumes as a single partition entry]" \
531            "k[skip zero length entries]" \
532            "K[skip all free & void partitions]" \
533            "m[merge small free partitions into a previous partition]" \
534            "i[ignore small free partitions caused by block alignment]"
535          ;;
536      esac
537      ;;
538    *)
539      _message "unknown hdiutil command: $words[1]"
540      _default
541      ;;
542  esac
543  return 1
544}
545
546_hdiutil "$@"
547