From c2e46ee43b519999ac2b48fc66f2e446a7e8f3a4 Mon Sep 17 00:00:00 2001 From: dana Date: Fri, 13 Mar 2020 09:33:32 -0500 Subject: 45534: _hdiutil: Update image-file extensions, image/disk formats, &c. --- Completion/Darwin/Command/_hdiutil | 87 +++++++++++++++++++++++++++----------- 1 file changed, 63 insertions(+), 24 deletions(-) (limited to 'Completion/Darwin') diff --git a/Completion/Darwin/Command/_hdiutil b/Completion/Darwin/Command/_hdiutil index c31808716..04e81e655 100644 --- a/Completion/Darwin/Command/_hdiutil +++ b/Completion/Darwin/Command/_hdiutil @@ -46,28 +46,40 @@ _hdiutil_imagesize(){ } _hdiutil_imageformat(){ - local -a fmts + local -a fmts ofmts fmts=( "UDRW:UDIF read/write image" "UDRO:UDIF read-only image" - "UDZO:UDIF zlib-compressed image" "UDCO:UDIF ADC-compressed image" - "UFBI:UDIF entire image with MD5 checksum" + "UDZO:UDIF zlib-compressed image" + "ULFO:UDIF lzfse-compressed image" + "ULMO:UDIF lzma-compressed image" + "UDBZ:UDIF bzip2-compressed image" "UDTO:DVD/CD-R master for export" - "UDxx:UDIF stub image" - "UDSP:SPARSE (growable with content)" - "Rdxx:NDIF read-only image (Disk Copy 6.3.3 format)" - "DC42:Disk Copy 4.2 image" + "UDSP:SPARSE (grows with content)" + "UDSB:SPARSEBUNDLE (grows with content; bundle-backed)" + "UFBI:UDIF entire image with MD5 checksum" ) ofmts=( "UDRo:UDIF read-only" "UDCo:UDIF compressed" "RdWr:NDIF read/write image" + "Rdxx:NDIF read-only image (Disk Copy 6.3.3 format)" "ROCo:NDIF compressed image" "Rken:NDIF compressed" + "DC42:Disk Copy 4.2 image" + "IPOD:iPod image" # Mentioned in help, not manual + "UDxx:UDIF stub image" # Mentioned in help, not manual + "UNIV:hybrid image (HFS+/ISO/UDF)" # Mentioned in help, not manual ) _describe -t types "image format" fmts -V1 || - _describe -t types "obsolete/deprecated image format" ofmts -V1 + _describe -t types "obsolete/deprecated image format" ofmts -V1 +} + +_hdiutil_images() { + local -a expl + _description files expl 'disk image' + _files "$@" "${(@)expl}" -g '*.(bin|cdr|dmg|img|iso|sparse(bundle|image))(-.)' } _hdiutil(){ @@ -178,7 +190,7 @@ _hdiutil(){ "(-autoopenro)-noautoopenro" \ "(-noautoopenrw)-autoopenrw[auto-open read/write volumes]" \ "(-autoopenrw)-noautoopenrw" \ - "1:disk image to attach:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1:disk image to attach:_hdiutil_images" \ && return 0 ;; detach|eject) @@ -195,7 +207,7 @@ _hdiutil(){ "$_common_usage_options[-imagekey]" \ "$_common_usage_options[-srcimagekey]" \ "$_common_usage_options[-plist]" \ - "1:disk image to verify:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1:disk image to verify:_hdiutil_images" \ && return 0 ;; create) @@ -214,8 +226,26 @@ _hdiutil(){ "($size_spec)-srcfolder[specify directory]: :_directories" \ "($size_spec)-srcdir[specify directory]: :_directories" \ "-align[size to which partition is aligned]:size" \ - "-type[image type]:image type:(UDIF SPARSE)" \ - "-fs[filesystem to make]:filesystem:(HFS+ HFS+J HFSX HFS MS-DOS UFS)" \ + "-type[image type]:image type:(( + SPARSEBUNDLE\:'sparse bundle disk image' + SPARSE\:'sparse disk image' + UDIF\:'read/write disk image' + UDTO\:'DVD/CD master' + ))" \ + "-fs[filesystem to make]:filesystem:(( + UDF\:'Universal Disk Format' + MS-DOS\ FAT12\:'MS-DOS (FAT12)' + MS-DOS\:'MS-DOS (FAT)' + MS-DOS\ FAT16\:'MS-DOS (FAT16)' + {FAT32,MS-DOS\ FAT32}\:'MS-DOS (FAT32)' + ExFAT\:'ExFAT' + HFS+\:'Mac OS Extended' + {HFS+J,JHFS+,HFSJ,Journaled\ HFS+}\:'Mac OS Extended (journaled)' + {HFS+X,HFSX,Case-sensitive\ HFS+}\:'Mac OS Extended (case-sensitive)' + {JHFS+X,JHFSX,HFS+X+J,HFS+XJ,HFSXJ,Case-sensitive\ Journaled\ HFS+}\:'Mac OS Extended (case-sensitive, journaled)' + APFS\:'APFS' + Case-sensitive\ APFS\:'APFS (case-sensitive)' + ))" \ "-volname[volume name]:name" \ "-uid[uid of root directory]:uid in number" \ "-gid[gid of root directory]:gid in number" \ @@ -225,7 +255,16 @@ _hdiutil(){ "(-autostretch)-noautostretch" \ "-stretch[max_stretch]: :_hdiutil_imagesize" \ "-fsargs[additional arguments to pass to newfs]:arguments" \ - "-layout[partition layout]:partition layout:(NONE SPUD UNIVERSAL\ CD UNIVERSAL\ HD)" \ + "-layout[partition layout]:partition layout:(( + MBRSPUD\:'single partition, MBR' + SPUD\:'single partition, APM' + UNIVERSAL\ CD\:'CD/DVD' + NONE\:'no partition map' + GPTSPUD\:'single partition, GPT' + SPCD\:'single partition, CD/DVD' + UNIVERSAL\ HD\:'hard disk' + ISOCD\:'single partition, CD/DVD with ISO data' + ))" \ "-partitionType[partition type]:partition type:(Apple_HFS Apple_UFS)" \ "-ov[overwrite an existing file]" \ "-attach[attach the image after creating it]" \ @@ -265,7 +304,7 @@ _hdiutil(){ "-ov[overwrite an existing file]" \ "-format:format:_hdiutil_imageformat" \ "-o:target disk image:_files" \ - "1:source disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1:source disk image:_hdiutil_images" \ && return 0 if [[ $state = keyvalue ]]; then @@ -302,7 +341,7 @@ _hdiutil(){ "-erase[erase the media]" \ "-fullerase[erase all sectors of the disc]" \ "-list[list all burning devices with paths suitable for -device]" \ - "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1: :_hdiutil_images" \ && return 0 ;; makehybrid) @@ -343,7 +382,7 @@ _hdiutil(){ "(-nokernel)-nokernel[attach with a helper process]" \ "(-kernel)-kernel[attach without a helper process]" \ "-o:target disk image:_files" \ - "1:source disk image or directory:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1:source disk image or directory:_hdiutil_images" \ && return 0 ;; compact) @@ -376,7 +415,7 @@ _hdiutil(){ "$_common_usage_options[-cacert]" \ "$_common_usage_options[-plist]" \ "-type:image type:(UDIF-CRC32 UDIF-MD5 DC42 CRC28 CRC32 MD5)" \ - "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1: :_hdiutil_images" \ && return 0 ;; chpass) @@ -386,7 +425,7 @@ _hdiutil(){ "$_common_usage_options[-srcimagekey]" \ "-oldstdinpass[specify old password from standard input]" \ "-newstdinpass[specify new password from standard input]" \ - "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1: :_hdiutil_images" \ && return 0 ;; unflatten) @@ -395,7 +434,7 @@ _hdiutil(){ "$_common_usage_options[-encryption]" \ "$_common_usage_options[-stdinpass]" \ "$_common_usage_options[-srcimagekey]" \ - "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1: :_hdiutil_images" \ && return 0 ;; flatten) @@ -408,7 +447,7 @@ _hdiutil(){ "(-noxml)-xml" \ "(-rsrcfork)-norsrcfork[don\'t embed resource fork data]" \ "(-norsrcfork)-rsrcfork" \ - "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1: :_hdiutil_images" \ && return 0 ;; hfsanalyze) @@ -420,7 +459,7 @@ _hdiutil(){ "$_common_usage_options[-shadow]" \ "$_common_usage_options[-insecurehttp]" \ "$_common_usage_options[-cacert]" \ - "1:disk image or device:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1:disk image or device:_hdiutil_images" \ && return 0 ;; mountvol) @@ -447,7 +486,7 @@ _hdiutil(){ "$_common_usage_options[-plist]" \ "-format[just print out the image format]" \ "-checksum[just print out the image checksum]" \ - "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1: :_hdiutil_images" \ && return 0 ;; plugins) @@ -462,7 +501,7 @@ _hdiutil(){ "$_common_usage_options[-srcimagekey]" \ "$_common_usage_options[-plist]" \ "(-yes -no -query)"{-yes,-no,-query} \ - "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1: :_hdiutil_images" \ && return 0 ;; @@ -514,7 +553,7 @@ _hdiutil(){ "$_common_usage_options[-insecurehttp]" \ "$_common_usage_options[-cacert]" \ "-options[just print out the image checksum]: :->option" \ - "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1: :_hdiutil_images" \ && return 0 case "$state" in -- cgit 1.4.1