mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-20 16:01:04 +02:00
45534: _hdiutil: Update image-file extensions, image/disk formats, &c.
This commit is contained in:
parent
3f7b81e24e
commit
c2e46ee43b
2 changed files with 66 additions and 24 deletions
|
@ -1,5 +1,8 @@
|
||||||
2020-03-13 dana <dana@dana.is>
|
2020-03-13 dana <dana@dana.is>
|
||||||
|
|
||||||
|
* 45534: Completion/Darwin/Command/_hdiutil: Update image-file
|
||||||
|
extensions, image/disk formats, &c.
|
||||||
|
|
||||||
* 45531: Completion/Unix/Command/_sh: Complete options more
|
* 45531: Completion/Unix/Command/_sh: Complete options more
|
||||||
accurately
|
accurately
|
||||||
|
|
||||||
|
|
|
@ -46,30 +46,42 @@ _hdiutil_imagesize(){
|
||||||
}
|
}
|
||||||
|
|
||||||
_hdiutil_imageformat(){
|
_hdiutil_imageformat(){
|
||||||
local -a fmts
|
local -a fmts ofmts
|
||||||
fmts=(
|
fmts=(
|
||||||
"UDRW:UDIF read/write image"
|
"UDRW:UDIF read/write image"
|
||||||
"UDRO:UDIF read-only image"
|
"UDRO:UDIF read-only image"
|
||||||
"UDZO:UDIF zlib-compressed image"
|
|
||||||
"UDCO:UDIF ADC-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"
|
"UDTO:DVD/CD-R master for export"
|
||||||
"UDxx:UDIF stub image"
|
"UDSP:SPARSE (grows with content)"
|
||||||
"UDSP:SPARSE (growable with content)"
|
"UDSB:SPARSEBUNDLE (grows with content; bundle-backed)"
|
||||||
"Rdxx:NDIF read-only image (Disk Copy 6.3.3 format)"
|
"UFBI:UDIF entire image with MD5 checksum"
|
||||||
"DC42:Disk Copy 4.2 image"
|
|
||||||
)
|
)
|
||||||
ofmts=(
|
ofmts=(
|
||||||
"UDRo:UDIF read-only"
|
"UDRo:UDIF read-only"
|
||||||
"UDCo:UDIF compressed"
|
"UDCo:UDIF compressed"
|
||||||
"RdWr:NDIF read/write image"
|
"RdWr:NDIF read/write image"
|
||||||
|
"Rdxx:NDIF read-only image (Disk Copy 6.3.3 format)"
|
||||||
"ROCo:NDIF compressed image"
|
"ROCo:NDIF compressed image"
|
||||||
"Rken:NDIF compressed"
|
"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 "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(){
|
_hdiutil(){
|
||||||
local -a _common_options
|
local -a _common_options
|
||||||
_common_options=(
|
_common_options=(
|
||||||
|
@ -178,7 +190,7 @@ _hdiutil(){
|
||||||
"(-autoopenro)-noautoopenro" \
|
"(-autoopenro)-noautoopenro" \
|
||||||
"(-noautoopenrw)-autoopenrw[auto-open read/write volumes]" \
|
"(-noautoopenrw)-autoopenrw[auto-open read/write volumes]" \
|
||||||
"(-autoopenrw)-noautoopenrw" \
|
"(-autoopenrw)-noautoopenrw" \
|
||||||
"1:disk image to attach:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
|
"1:disk image to attach:_hdiutil_images" \
|
||||||
&& return 0
|
&& return 0
|
||||||
;;
|
;;
|
||||||
detach|eject)
|
detach|eject)
|
||||||
|
@ -195,7 +207,7 @@ _hdiutil(){
|
||||||
"$_common_usage_options[-imagekey]" \
|
"$_common_usage_options[-imagekey]" \
|
||||||
"$_common_usage_options[-srcimagekey]" \
|
"$_common_usage_options[-srcimagekey]" \
|
||||||
"$_common_usage_options[-plist]" \
|
"$_common_usage_options[-plist]" \
|
||||||
"1:disk image to verify:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
|
"1:disk image to verify:_hdiutil_images" \
|
||||||
&& return 0
|
&& return 0
|
||||||
;;
|
;;
|
||||||
create)
|
create)
|
||||||
|
@ -214,8 +226,26 @@ _hdiutil(){
|
||||||
"($size_spec)-srcfolder[specify directory]: :_directories" \
|
"($size_spec)-srcfolder[specify directory]: :_directories" \
|
||||||
"($size_spec)-srcdir[specify directory]: :_directories" \
|
"($size_spec)-srcdir[specify directory]: :_directories" \
|
||||||
"-align[size to which partition is aligned]:size" \
|
"-align[size to which partition is aligned]:size" \
|
||||||
"-type[image type]:image type:(UDIF SPARSE)" \
|
"-type[image type]:image type:((
|
||||||
"-fs[filesystem to make]:filesystem:(HFS+ HFS+J HFSX HFS MS-DOS UFS)" \
|
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" \
|
"-volname[volume name]:name" \
|
||||||
"-uid[uid of root directory]:uid in number" \
|
"-uid[uid of root directory]:uid in number" \
|
||||||
"-gid[gid of root directory]:gid in number" \
|
"-gid[gid of root directory]:gid in number" \
|
||||||
|
@ -225,7 +255,16 @@ _hdiutil(){
|
||||||
"(-autostretch)-noautostretch" \
|
"(-autostretch)-noautostretch" \
|
||||||
"-stretch[max_stretch]: :_hdiutil_imagesize" \
|
"-stretch[max_stretch]: :_hdiutil_imagesize" \
|
||||||
"-fsargs[additional arguments to pass to newfs]:arguments" \
|
"-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)" \
|
"-partitionType[partition type]:partition type:(Apple_HFS Apple_UFS)" \
|
||||||
"-ov[overwrite an existing file]" \
|
"-ov[overwrite an existing file]" \
|
||||||
"-attach[attach the image after creating it]" \
|
"-attach[attach the image after creating it]" \
|
||||||
|
@ -265,7 +304,7 @@ _hdiutil(){
|
||||||
"-ov[overwrite an existing file]" \
|
"-ov[overwrite an existing file]" \
|
||||||
"-format:format:_hdiutil_imageformat" \
|
"-format:format:_hdiutil_imageformat" \
|
||||||
"-o:target disk image:_files" \
|
"-o:target disk image:_files" \
|
||||||
"1:source disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
|
"1:source disk image:_hdiutil_images" \
|
||||||
&& return 0
|
&& return 0
|
||||||
|
|
||||||
if [[ $state = keyvalue ]]; then
|
if [[ $state = keyvalue ]]; then
|
||||||
|
@ -302,7 +341,7 @@ _hdiutil(){
|
||||||
"-erase[erase the media]" \
|
"-erase[erase the media]" \
|
||||||
"-fullerase[erase all sectors of the disc]" \
|
"-fullerase[erase all sectors of the disc]" \
|
||||||
"-list[list all burning devices with paths suitable for -device]" \
|
"-list[list all burning devices with paths suitable for -device]" \
|
||||||
"1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
|
"1: :_hdiutil_images" \
|
||||||
&& return 0
|
&& return 0
|
||||||
;;
|
;;
|
||||||
makehybrid)
|
makehybrid)
|
||||||
|
@ -343,7 +382,7 @@ _hdiutil(){
|
||||||
"(-nokernel)-nokernel[attach with a helper process]" \
|
"(-nokernel)-nokernel[attach with a helper process]" \
|
||||||
"(-kernel)-kernel[attach without a helper process]" \
|
"(-kernel)-kernel[attach without a helper process]" \
|
||||||
"-o:target disk image:_files" \
|
"-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
|
&& return 0
|
||||||
;;
|
;;
|
||||||
compact)
|
compact)
|
||||||
|
@ -376,7 +415,7 @@ _hdiutil(){
|
||||||
"$_common_usage_options[-cacert]" \
|
"$_common_usage_options[-cacert]" \
|
||||||
"$_common_usage_options[-plist]" \
|
"$_common_usage_options[-plist]" \
|
||||||
"-type:image type:(UDIF-CRC32 UDIF-MD5 DC42 CRC28 CRC32 MD5)" \
|
"-type:image type:(UDIF-CRC32 UDIF-MD5 DC42 CRC28 CRC32 MD5)" \
|
||||||
"1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
|
"1: :_hdiutil_images" \
|
||||||
&& return 0
|
&& return 0
|
||||||
;;
|
;;
|
||||||
chpass)
|
chpass)
|
||||||
|
@ -386,7 +425,7 @@ _hdiutil(){
|
||||||
"$_common_usage_options[-srcimagekey]" \
|
"$_common_usage_options[-srcimagekey]" \
|
||||||
"-oldstdinpass[specify old password from standard input]" \
|
"-oldstdinpass[specify old password from standard input]" \
|
||||||
"-newstdinpass[specify new password from standard input]" \
|
"-newstdinpass[specify new password from standard input]" \
|
||||||
"1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
|
"1: :_hdiutil_images" \
|
||||||
&& return 0
|
&& return 0
|
||||||
;;
|
;;
|
||||||
unflatten)
|
unflatten)
|
||||||
|
@ -395,7 +434,7 @@ _hdiutil(){
|
||||||
"$_common_usage_options[-encryption]" \
|
"$_common_usage_options[-encryption]" \
|
||||||
"$_common_usage_options[-stdinpass]" \
|
"$_common_usage_options[-stdinpass]" \
|
||||||
"$_common_usage_options[-srcimagekey]" \
|
"$_common_usage_options[-srcimagekey]" \
|
||||||
"1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
|
"1: :_hdiutil_images" \
|
||||||
&& return 0
|
&& return 0
|
||||||
;;
|
;;
|
||||||
flatten)
|
flatten)
|
||||||
|
@ -408,7 +447,7 @@ _hdiutil(){
|
||||||
"(-noxml)-xml" \
|
"(-noxml)-xml" \
|
||||||
"(-rsrcfork)-norsrcfork[don\'t embed resource fork data]" \
|
"(-rsrcfork)-norsrcfork[don\'t embed resource fork data]" \
|
||||||
"(-norsrcfork)-rsrcfork" \
|
"(-norsrcfork)-rsrcfork" \
|
||||||
"1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
|
"1: :_hdiutil_images" \
|
||||||
&& return 0
|
&& return 0
|
||||||
;;
|
;;
|
||||||
hfsanalyze)
|
hfsanalyze)
|
||||||
|
@ -420,7 +459,7 @@ _hdiutil(){
|
||||||
"$_common_usage_options[-shadow]" \
|
"$_common_usage_options[-shadow]" \
|
||||||
"$_common_usage_options[-insecurehttp]" \
|
"$_common_usage_options[-insecurehttp]" \
|
||||||
"$_common_usage_options[-cacert]" \
|
"$_common_usage_options[-cacert]" \
|
||||||
"1:disk image or device:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
|
"1:disk image or device:_hdiutil_images" \
|
||||||
&& return 0
|
&& return 0
|
||||||
;;
|
;;
|
||||||
mountvol)
|
mountvol)
|
||||||
|
@ -447,7 +486,7 @@ _hdiutil(){
|
||||||
"$_common_usage_options[-plist]" \
|
"$_common_usage_options[-plist]" \
|
||||||
"-format[just print out the image format]" \
|
"-format[just print out the image format]" \
|
||||||
"-checksum[just print out the image checksum]" \
|
"-checksum[just print out the image checksum]" \
|
||||||
"1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
|
"1: :_hdiutil_images" \
|
||||||
&& return 0
|
&& return 0
|
||||||
;;
|
;;
|
||||||
plugins)
|
plugins)
|
||||||
|
@ -462,7 +501,7 @@ _hdiutil(){
|
||||||
"$_common_usage_options[-srcimagekey]" \
|
"$_common_usage_options[-srcimagekey]" \
|
||||||
"$_common_usage_options[-plist]" \
|
"$_common_usage_options[-plist]" \
|
||||||
"(-yes -no -query)"{-yes,-no,-query} \
|
"(-yes -no -query)"{-yes,-no,-query} \
|
||||||
"1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
|
"1: :_hdiutil_images" \
|
||||||
&& return 0
|
&& return 0
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -514,7 +553,7 @@ _hdiutil(){
|
||||||
"$_common_usage_options[-insecurehttp]" \
|
"$_common_usage_options[-insecurehttp]" \
|
||||||
"$_common_usage_options[-cacert]" \
|
"$_common_usage_options[-cacert]" \
|
||||||
"-options[just print out the image checksum]: :->option" \
|
"-options[just print out the image checksum]: :->option" \
|
||||||
"1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
|
"1: :_hdiutil_images" \
|
||||||
&& return 0
|
&& return 0
|
||||||
|
|
||||||
case "$state" in
|
case "$state" in
|
||||||
|
|
Loading…
Reference in a new issue