Compare commits

..

1 Commits

Author SHA1 Message Date
Alexander F. Rødseth b6da0fe797
Merge 4f793a0031 into 7fbdd25526 2025-11-04 16:09:10 +05:30
7 changed files with 546 additions and 2065 deletions

View File

@ -1,66 +0,0 @@
#compdef augmatch
# ------------------------------------------------------------------------------
# Copyright (c) 2025 Github zsh-users - https://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for augmatch 1.14.1 (https://augeas.net/)
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Shohei Yoshida (https://github.com/syohex) <syohex@gmail.com>
#
# ------------------------------------------------------------------------------
_augmatch_lens() {
local lenses=($(augtool --noload 'match /augeas/load/*/lens' | sed -e 's/.*@//'))
_values lenses $lenses
}
_arguments \
'(- *)'{-h,--help}'[show help message]' \
'(-a --all)'{-a,--all}'[print all tree nodes, even ones without an associated value]' \
'(-e --extract)'{-e,--extract}'[only print the parts of the tree that are matched with --match]' \
\*{-I,--include=}'[add directory to the module loadpath]:dir:_files -/' \
'(-l --lens)'{-l,--lens=}'[use lens for the given file]:lens:_augmatch_lens' \
'(-L --print-lens)'{-L,--print-lens}'[print the name of lens]' \
'(-m --match)'{-m,--match=}'[only print the parts of the tree that match]:expr' \
'(-r --root)'{-r,--root=}'[use directory as the root of the filesystem]:dir:_files -/' \
'(-S --nostdinc)'{-S,--nostdinc}'[do not search any of the default directories for lenses]' \
'(-o --only-value)'{-o,--only-value}'[print only the value and not label or the path of nodes]' \
'(-q --quiet)'{-q,--quiet}'[do not print anything]' \
'*:: :_files'
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@ -1,56 +0,0 @@
#compdef augparse
# ------------------------------------------------------------------------------
# Copyright (c) 2025 Github zsh-users - https://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for augparse 1.14.1 (https://augeas.net/)
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Shohei Yoshida (https://github.com/syohex) <syohex@gmail.com>
#
# ------------------------------------------------------------------------------
_arguments \
'(- *)'{-h,--help}'[show help message]' \
'(- *)--version[print version information and exit]' \
\*{-I,--include=}'[add directory to the module loadpath]:dir:_files -/' \
'(-t --trace)'{-t,--trace}'[print a trace of modules that are being loaded]' \
'--nostdinc[do not search any of the default directories for modules]' \
'--notypecheck[do not perform lens type checks]' \
'*:: :_files'
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@ -1,61 +0,0 @@
#compdef augprint
# ------------------------------------------------------------------------------
# Copyright (c) 2025 Github zsh-users - https://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for augprint 1.14.1 (https://augeas.net/)
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Shohei Yoshida (https://github.com/syohex) <syohex@gmail.com>
#
# ------------------------------------------------------------------------------
_augprint_lens() {
local lenses=($(augtool --noload 'match /augeas/load/*/lens' | sed -e 's/.*@//'))
_values lenses $lenses
}
_arguments \
'(- *)'{-h,--help}'[show help message]' \
'(-v --verbose)'{-v,--verbose}'[include the original numbered paths as comments in the output]' \
'(-r --regexp)'{-r-,--regexp=-}'[generate regular expressions to match values]:num' \
'(-l --lens)'{-l,--lens=}'[use lens for the given file]:lens:_augprint_lens' \
'(-t --target)'{-t,--target=}'[generate the script as if its path was really targetfile]:file:_files' \
'(-s --noseq)'{-s,--noseq}'[do not use "seq::*" in the output]' \
'*:: :_files'
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@ -28,7 +28,7 @@
# Description # Description
# ----------- # -----------
# #
# Completion script for Capistrano 3.19.2 (https://capistranorb.com/) # Completion script for Capistrano 3.17.1 (https://capistranorb.com/)
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Authors # Authors
@ -46,24 +46,22 @@ _arguments -C \
'--backtrace=[Enable full backtrace]: :(stderr stdout)' \ '--backtrace=[Enable full backtrace]: :(stderr stdout)' \
'--comments[Show commented tasks only]' \ '--comments[Show commented tasks only]' \
'--job-stats[Display job statistics]:level' \ '--job-stats[Display job statistics]:level' \
'--rules[Trace the rules resolution]' \
'--suppress-backtrace[Suppress backtrace lines matching regexp PATTERN]:pattern' \ '--suppress-backtrace[Suppress backtrace lines matching regexp PATTERN]:pattern' \
'(-A --all)'{-A,--all}'[Show all tasks, even uncommented ones]' \ '(-A --all)'{-A,--all}'[Show all tasks, even uncommented ones]' \
'(-B --build-all)'{-B,--build-all}'[Build all prerequisites, including those which are up-to-date]' \ '(-B --build-all)'{-B,--build-all}'[Build all prerequisites, including those which are up-to-date]' \
'(-C --directory)'{-C,--directory}'[Change to DIRECTORY before doing anything]: :_files -/' \ '(-C --directory)'{-C,--directory}'[Change to DIRECTORY before doing anything]: :_files -/' \
'(-D --describe)'{-D,--describe}'[Describe the tasks, then exit]:pattern' \ '(-D --describe)'{-D,--describe}'[Describe the tasks, then exit]:pattern' \
'(-e --execute)'{-e,--execute}'[Execute some Ruby code and exit]:code' \ '(-E --execute-continue)'{-E,--execute-continue}'[Execute Ruby code and exit]:code' \
'(-E --execute-continue)'{-E,--execute-continue}'[Execute Ruby code and continue with task processing]:code' \
'(-f --rakefile)'{-f,--rakefile}'[Use FILENAME as the rakefile to search for]: :_files' \ '(-f --rakefile)'{-f,--rakefile}'[Use FILENAME as the rakefile to search for]: :_files' \
'(-G --no-system --nosystem)'{-G,--no-system,--nosystem}'[Use standard project Rakefile search paths, ignore system wide rakefiles]' \ '(-G --no-system --nosystem)'{-G,--no-system,--nosystem}'[Use standard project Rakefile search paths, ignore system wide rakefiles]' \
'(-g --system)'{-g,--system}'[Using system wide rakefiles]' \ '(-g --system)'{-g,--system}'[Using system wide rakefiles]' \
'(-I --libdir)'\*{-I,--libdir}'[Include LIBDIR in the search path for required modules]: :_files -/' \ '(-I --libdir)'\*{-I,--libdir}'[Include LIBDIR in the search path for required modules]: :_files -/' \
'(-j --jobs)'{-j-,--jobs-}'[Specifies the maximum number of tasks to execute in parallel]:num' \ '(-j --jobs)'{-j,--jobs}'[Specifies the maximum number of tasks to execute in parallel]:num' \
'(-m --multitask)'{-m,--multitask}'[Treat all tasks as multitasks]' \ '(-m --multitask)'{-m,--multitask}'[Treat all tasks as multitasks]' \
'(-N --no-search --nosearch)'{-N,--no-search,--nosearch}'[Do not search parent directories for the Rakefile]' \ '(-N --no-search --nosearch)'{-N,--no-search,--nosearch}'[Do not search parent directories for the Rakefile]' \
'(-P --prereqs)'{-P,--prereqs}'[Display the tasks and dependencies, then exit]' \ '(-P --prereqs)'{-P,--prereqs}'[Display the tasks and dependencies, then exit]' \
'--execute-print[Execute some Ruby code, print the result, then exit]:code' \ '--execute-print[Execute some Ruby code, print the result, then exit]:code' \
'*--require[Require MODULE before executing rakefile]:module' \ '--require[Require MODULE before executing rakefile]:module' \
'(-R --rakelibdir --rakelib)'{-R,--rakelibdir,--rakelib}'[Auto-import any .rake files in RAKELIBDIR]: :_files -/' \ '(-R --rakelibdir --rakelib)'{-R,--rakelibdir,--rakelib}'[Auto-import any .rake files in RAKELIBDIR]: :_files -/' \
'(-t --trace)'{-t,--trace}'[Turn on invoke/execute tracing, enable full backtrace]: :(stderr stdout)' \ '(-t --trace)'{-t,--trace}'[Turn on invoke/execute tracing, enable full backtrace]: :(stderr stdout)' \
'(-T --tasks)'{-T,--tasks}'[Display the tasks with descriptions]::pattern' \ '(-T --tasks)'{-T,--tasks}'[Display the tasks with descriptions]::pattern' \

View File

@ -1,262 +0,0 @@
#compdef certbot
# ------------------------------------------------------------------------------
# Copyright (c) 2025 Github zsh-users - https://github.com/zsh-users
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for certbot 5.1.0 (https://github.com/certbot/certbot)
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Shohei Yoshida (https://github.com/syohex) <syohex@gmail.com>
#
# ------------------------------------------------------------------------------
_certbot() {
typeset -A opt_args
local context state line
local curcontext="$curcontext"
local ret=1
_arguments -C -A "-*" \
'(- *)'{-h,--help}'[Print help message]:topic:_certbot_help_topics' \
'(- *)--version[Print version and exit]' \
'1: :_certbot_subcommands' \
'*::arg:->args' \
&& ret=0
case "$state" in
(args)
local -a opts=(
'(- *)'{-h,--help}'[Show help message and exit]'
'(-c --config)'{-c,--config}'[Path to config file]:config_file:_files'
)
case $words[1] in
(run|certonly|renew|enhance|certificates|delete|reconfigure)
opts+=(
'--cert-name[Certificate name to apply]:name'
)
;|
(run|certonly|renew|reconfigure)
opts+=(
'--deploy-hook[Command to be run once for each successfully issued certificate]:hook'
)
;|
(run|certonly|renew)
opts+=(
'(-q --quiet)'{-q,--quiet}'[Silence all output except errors]'
'--required-profile[Request the given profile name from the ACME server]:profile'
'--preferred-profile[Request the given profile name from the ACME server]:profile'
'--preferred-chain[Set the preferred certificate chain]:chain'
)
;|
(run|certonly|enhance|certificates)
opts+=(
'(-d --domains --domain)'{-d,--domains,--domain}'[Domain names to include]'
)
;|
(run|certonly|enhance|register)
opts+=(
'--force-interactive[Force Certbot to be interactive even not in a terminal]'
)
;|
(run|certonly|enhance)
opts+=(
'(-n --non-interactive --noninteractive)'{-n,--non-interactive,--noninteractive}'[Run without ever asking for user input]'
)
;|
(run|certonly|register)
opts+=(
'--eab-kid[Key identifier for External Account Binding]:eab_kid'
'--eab-hmac-key[HMAC key for External Account Binding]:eab_hmac_key'
'--eab-hmac-alg[HMAC algorithm for External Account Binding(default: HS256)]:algorithm:(HS256 HS384 HS512)'
)
;|
(run|certonly)
opts+=(
'(--keep-until-expiring --keep --reinstall)'{--keep-until-expiring,--keep,--reinstall}'[Always keep the existing one until it is due for renewal]'
'--debug-challenges[After setting up challenges, wait for user input before submitting to CA]'
'--issuance-timeout[How many seconds Certbot will wait for the server to issue a certificate]:seconds'
'--apache[Obtain and install certificates using Apache]'
'--nginx[Obtain and install certificates using Nginx]'
)
;|
(certonly|renew|reconfigure)
opts+=(
'--run-deploy-hooks[run any applicable deploy hooks]'
)
;|
(certonly|renew)
opts+=(
"--dry-run[Perform a test run against the Let's Encrypt staging server]"
'--allow-subset-of-names[When performing domain validation, do not consider it a failure]'
'--preferred-challenges[A sorted, comma delimited list of the preferred challenge]:challenges'
)
;|
(run|revoke)
opts+=(
'(--test-cert --staging)'{--test-cert,--staging}"[Use the Let's Encrypt staging server to obtain or revoke test]"
)
;|
(certonly|revoke)
opts+=(
'--cert-path[Path to where certificate is saved]:cert:_files'
)
;|
(certonly|reconfigure)
opts+=(
'--webroot[Obtain certificates by placing files in a webroot directory]'
)
;|
(certonly)
opts+=(
'--csr[Path to a Certificate Signing Request (CSR) in DER or PEM format]:csr:_files'
'--standalone[Obtain certificates using a "standalone" webserver]'
'--manual[Provide laborious manual instructions for obtaining a certificate]'
'--dns-cloudflare[Obtain certificates using a Cloudflare DNS TXT record]'
'--dns-digitalocean[Obtain certificates using a DigitalOcean DNS TXT record]'
'--dns-dnsimple[Obtain certificates using a DNSimple DNS TXT record]'
'--dns-dnsmadeeasy[Obtain certificates using a DNS Made Easy DNS TXT record]'
'--dns-gehirn[Obtain certificates using a Gehirn DNS TXT record]'
'--dns-google[Obtain certificates using a Google Cloud DNS TXT record]'
'--dns-linode[Obtain certificates using a Linode DNS TXT record]'
'--dns-luadns[Obtain certificates using a LuaDNS DNS TXT record]'
'--dns-nsone[Obtain certificates using a NS1 DNS TXT record]'
'--dns-ovh[Obtain certificates using a OVH DNS TXT record]'
'--dns-rfc2136[Obtain certificates using a BIND DNS TXT record]'
'--dns-route53[Obtain certificates using a Route53 DNS TXT record]'
'--dns-sakuracloud[Obtain certificates using a Sakura Cloud DNS TXT record]'
)
;|
(renew|reconfigure)
opts+=(
'--pre-hook[Command to be run before obtaining any certificates]:pre_hook'
'--post-hook[Command to be run after attempting to obtain/renew certificates]:post_hook'
)
;|
(renew)
opts+=(
'(--force-renewal --renew-by-default)'{--force-renewal,--renew-by-default}'[renew now regardless of whether it is near expiry]'
'--disable-hook-validation[Disable command validation for hook commands]'
"--no-directory-hooks[Disable running executables found in Certbot's hook directories]"
'--disable-renew-updates[Disable automatic updates to your server configuration]'
'--no-autorenew[Disable auto renewal of certificates]'
)
;|
(enhance)
opts+=(
'--redirect[Automatically redirect all HTTP traffic to HTTPS]'
'--hsts[Add Strict-Transport-Security header to every HTTP response]'
'--uir[Add "Content-Security-Policy: upgrade-insecure-requests" header to every HTTP response]'
'--auto-hsts[Gradually increasing max-age value for HTTP Strict Transport Security security header]'
)
;|
(revoke)
opts+=(
'--reason[Specify reason for revoking certificates]:reason:(unspecified keycompromise affiliationchanged superseded cessationofoperation)'
'(--delete-after-revoke --no-delete-after-revoke)--delete-after-revoke[Delete certificates after revoking them]'
'(--delete-after-revoke --no-delete-after-revoke)--no-delete-after-revoke[Do not delete certificates after revoking them]'
'--key-path[Path to private key for certificates instructions or revocation]:key_path:_files'
)
;|
(reconfigure)
opts+=(
'(-a --authenticator)'{-a,--authenticator}'[Authenticator plugin name]:plugin'
'(-i --installer)'{-i,--installer}'[Installer plugin name]:plugin'
)
;|
(register|unregister|update_account)
opts+=(
'(-m --email)'{-m,--email}'[Email used for registration and recovery contact]:email')
;|
(register|update_account)
opts+=(
'(--eff-email --no-eff-email)--eff-email[Share your e-mail address with EFF]'
'(--eff-email --no-eff-email)--no-eff-email[Do not share your email address with EFF]'
)
;|
(unregister)
opts+=(
'--account[Account ID to use]:account_id'
)
;|
(show_account)
opts+=(
'--server[ACME Directory Resource URI]:server'
)
;|
esac
_arguments "$opts[@]" && ret=0
;;
esac
return ret
}
(( $+functions[_certbot_subcommands] )) ||
_certbot_subcommands() {
local -a commands=(
"run:Obtain & install a certificate in your current webserver"
"certonly:Obtain or renew a certificate, but do not install it"
"renew:Renew all previously obtained certificates that are near"
"enhance:Add security enhancements to your existing configuration"
"certificates:Display information about certificates you have from Certbot"
"revoke:Revoke a certificate (supply --cert-name or --cert-path)"
"delete:Delete a certificate (supply --cert-name)"
"reconfigure:Update a certificate's configuration (supply --cert-name)"
"register:Create an ACME account"
"unregister:Deactivate an ACME account"
"update_account:Update an ACME account"
"show_account:Display account details"
)
_describe -t commands 'command' commands "$@"
}
(( $+functions[_certbot_help_topics] )) ||
_certbot_help_topics() {
local -a topics=(
# topics
all automation commands paths security testing
# subcommands
run certonly renew enhance certificates revoke delete reconfigure register unregister
update_account show_account
# plugins
nginx apache standalone webroot
)
_values topics $topics
}
_certbot "$@"
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@ -1,634 +0,0 @@
#compdef diskutil
# ------------------------------------------------------------------------------
# Copyright (c) 2025 Github zsh-users - https://github.com/zsh-users
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for diskutil command macOS 26
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Shohei Yoshida (https://github.com/syohex)
#
# ------------------------------------------------------------------------------
_diskutil() {
typeset -A opt_args
local context state line
local curcontext="$curcontext"
local ret=1
_arguments \
'1: :_diskutil_subcommands' \
'*::arg:->args' \
&& ret=0
case "$state" in
(args)
case $words[1] in
(list)
_arguments \
'-plist[output plist instead of normal user-readable output]' \
'1:: :(internal external)' \
'2:: :(physical virtual)' \
&& ret=0
;;
(info)
_arguments \
'-plist[output plist instead of normal user-readable output]' \
'-all[output all disks]' \
&& ret=0
;;
(listFilesystems)
_arguments \
'-plist[output plist instead of normal user-readable output]' \
&& ret=0
;;
(unmount|unmountDisk|eject|disableJournal|disableJournal)
_alternative 'force: :(force)' 'device: :_files' \
&& ret=0
;;
(mount)
_arguments \
'-mountOptions[mount options]:option' \
'-mountPoint[mount point]:path:_files -/' \
'*:: :_diskutil_mount_args' \
&& ret=0
;;
(moveJournal)
_alternative 'internal: :(internal)' 'device: :_files' \
&& ret=0
;;
(eraseDisk)
_arguments \
'-noEFI[do not create EFI partition]' \
'1:format:_diskutil_file_systems' \
'2:name' \
'*:: :_diskutil_erasedisk_args' \
&& ret=0
;;
(eraseVolume)
_arguments \
'1:format:_diskutil_file_systems' \
'2:name' \
'*:: :_diskutil_erasedisk_args' \
&& ret=0
;;
(zeroDisk)
_alternative 'force: :(force)' 'short: :(short)' 'device: :_files' \
&& ret=0
;;
(secureErase)
_arguments \
'1:format:_diskutil_secure_erase_args' \
'*:: :_files' \
&& ret=0
;;
(partitionDisk)
_arguments \
'-noEFI[do not create EFI partition on the target disk]' \
'*:: :_files' \
&& ret=0
;;
(resizeVolume)
_arguments \
'-plist[emit a property list instead of user-formatted output]' \
'*:: :_files' \
&& ret=0
;;
(APFS)
_diskutil_APFS && ret=0
;;
(appleRAID)
_diskutil_appleRAID && ret=0
;;
(coreStorage)
_diskutil_corestorage && ret=0
;;
(image)
_diskutil_image && ret=0
;;
(*)
_arguments \
'*:: :_files' \
&& ret=0
;;
esac
;;
esac
return ret
}
(( $+functions[_diskutil_subcommands] )) ||
_diskutil_subcommands() {
local -a commands=(
"list:List disks"
"info:Get detailed information about a specific whole disk or partition"
"activity:Continuously display system-wide disk manipulation activity"
"listFilesystems:Show the file system personalities available for formatting"
"unmount:Unmount a single volume"
"unmountDisk:Given a disk containing a partition map, unmount all of its volumes"
"eject:Eject a disk"
"mount:Mount a single volume"
"mountDisk:Mount all mountable and UI-browsable volumes on the give partition map"
"rename:Rename a volume"
"enableJournal:Enable journaling on an HFS+ volume"
"disableJournal:Disable journaling on an HFS+ volume"
"moveJournal:Create a 512MB Apple_Journal partiton"
"enableOwnership:Enable ownership a volume"
"disableOwnership:Disable ownership of a volume"
"verifyVolume:Verify the file system data structures of a volume"
"repairVolume:Repair the file system data structures of a volume"
"verifyDisk:Verify the partition map layout of a whole disk intended for booting or data use"
"repairDisk:Repair the partition map layout of a whole disk intended for booting or data use"
"eraseDisk:Erase an existing disk"
"eraseVolume:Write out a new empty file system volume"
"reformat:Erase an existing volume by writing out a new empty file system"
"eraseOptical:Erase optical media"
"zeroDisk:Erase a device, writing zeros to the media"
"randomDisk:Erase a whole disk, writing random data to the media"
"secureErase:Erase, using a secure method"
"partitionDisk:Partition a disk, removing all volumes"
"resizeVolume:Non-destructively resize a volume"
"splitPartition:Destructively split a volume into multiple partitions"
"mergePartitions:Merge two or more partitions on a disk"
"addPartition:Create a new partition following an existing partition"
"APFS:Apple APFS is a system of virtual volumes"
"appleRAID:create, manipulate, destroy AppleRAID volumes"
"coreStorage:gather information/remove CoreStorage volumes"
"image:manipulate DiskImages framework with StorageKit framework"
)
_describe -t commands 'command' commands "$@"
}
(( $+functions[_diskutil_mount_args] )) ||
_diskutil_mount_args() {
local ret=1
local -a attributes=(
'readonly[the file system is mounted read only]'
'nobrowse[the file system is mounted with a recommendation to prevent display]'
)
_alternative \
'attributes: :_values -w attributes $attributes' \
'device: :_files' && ret=0
return ret
}
(( $+functions[_diskutil_erasedisk_args] )) ||
_diskutil_erasedisk_args() {
local ret=1
_alternative \
'type: :(APM MBR GPT)' \
'device: :_files' && ret=0
return ret
}
(( $+functions[_diskutil_secure_erase_args] )) ||
_diskutil_secure_erase_args() {
local ret=1
local -a levels=(
'0[Single-pass zero fill erase]'
'1[Single-pass random fill erase]'
'2[Seven-pass erase]'
'3[Gutmann algorithm 35-pass erase]'
'4[Three-pass erase, consisting of two random fills plus a final zero fill]'
)
_alternative \
'freespace: :(freespace)' \
'level: :_values level $levels' && ret=0
return ret
}
(( $+functions[_diskutil_file_systems] )) ||
_diskutil_file_systems() {
local file_systems=(
'APFSX:Case-sensitive APFS'
'APFS:APFS'
'ExFAT:ExFat'
'FREE:Free Space'
'MS-DOS:FAT'
'FAT32:FAT32'
'HFS+:MacOS Extended HFS+'
'HFSX:Case-sensitive Mac OS Extended HFS+'
'JHFSX:Case-sensitive and journaled Mac OS Extended HFS+'
'JHFS+:Journaled Mac OS Extended HFS+'
)
_describe -t file_systems 'file_system' file_systems "$@"
}
(( $+functions[_diskutil_APFS] )) ||
_diskutil_APFS() {
local ret=1
_arguments -C \
'1: :_diskutil_APFS_subcommands' \
'*:: :->arg' \
&& ret=0
case $state in
(arg)
case $words[1] in
(list|resizeContainer|listCryptoUsers|listSnapshots)
_arguments \
'-plist[emit a property list instead of user-formatted output]' \
'*:: :_files' \
&& ret=0
;;
(convert)
_arguments \
'-dryrun[all calculations, checks, some data moving is performed but your disk is left as valid HFS]' \
'-prebootSource[staging directory of macOS boot items]' \
'*:: :_files' \
&& ret=0
;;
(deleteContainer)
_arguments \
'-force[Activate an alternate last-resort mode]' \
'*:: :_files' \
&& ret=0
;;
(addVolume)
_arguments \
'-passprompt[will be prompted interactively for a passphrase]' \
'-passphrase[passphrase]:passphrase' \
'-stdinpassphrase[read passphrase from standard input]' \
'-passphraseHint[passphrase hint]:hint' \
'-reserve[guarantee a minimum amount of space for your volume]:reserve' \
"-quota[limit your volume's file usage to a maximum amount]:quota" \
'-role[meta-data flags from APFS Volume Roles]:roles' \
'-groupWith[become a member of the same APFS Volume Group]' \
'-sibling[sibling group device]:group_device' \
'-nomount[leave volume unmounted]' \
'-mountpoint[mountpoint path]:path:_files' \
'*:: :_files' \
&& ret=0
;;
(eraseVolume)
_arguments \
'-passprompt[will be prompted interactively for a passphrase]' \
'-passphrase[passphrase]:passphrase' \
'-stdinpassphrase[read passphrase from standard input]' \
'-passphraseHint[passphrase hint]:hint' \
'-role[meta-data flags from APFS Volume Roles]:roles' \
'-groupWith[become a member of the same APFS Volume Group]' \
'-sibling[sibling group device]:group_device' \
'*:: :_files' \
&& ret=0
;;
(unlockVolume)
_arguments \
'-user[cryptographic user]:user' \
'-recoverykeychain[key chain file]:path:_files' \
'-passphrase[passphrase]:passphrase' \
'-stdinpassphrase[read passphrase from standard input]' \
'-nomount[leave volume unmounted]' \
'-mountpoint[mountpoint path]:path:_files' \
'-systemreadwrite[mount read/write]' \
'-verify[test passphrase correctness without affecting the locked or unlocked state]' \
'-plist[emit a property list instead of user-formatted output]' \
'*:: :_files' \
&& ret=0
;;
(changePassphrase)
_arguments \
'-user[cryptographic user]:user' \
'-oldPassphrase[old passphrase]:old_passphrase' \
'-oldStdinpassphrase[read old passphrase from standard input]' \
'-newPassphrase[new passphrase]:new_passphrase' \
'-newStdinpassphrase[read new passphrase from standard input]' \
'*:: :_files' \
&& ret=0
;;
(setPassphraseHint)
_arguments \
'-user[cryptographic user]:user' \
'-hint[hint message]:hint' \
'-clear[clear any existing hint]' \
'*:: :_files' \
&& ret=0
;;
(encryptVolume)
_arguments \
'-user[cryptographic user]:user' \
'-passphrase[passphrase]:passphrase' \
'-stdinpassphrase[read passphrase from standard input]' \
'*:: :_files' \
&& ret=0
;;
(decryptVolume)
_arguments \
'-user[cryptographic user]:user' \
'-recoverykeychain[key chain file]:path:_files' \
'-passphrase[passphrase]:passphrase' \
'-stdinpassphrase[read passphrase from standard input]' \
'*:: :_files' \
&& ret=0
;;
(deleteSnapshot)
_arguments \
'-user[cryptographic user]:user' \
'-xid[transaction ID]:xid' \
'-name[snapshort name]:name' \
'-wait[wait for removing snapshot]' \
'*:: :_files' \
&& ret=0
;;
(updatePreboot)
_arguments \
'-od[open directory path]:dir:_files -/' \
'*:: :_files' \
&& ret=0
;;
esac
;;
esac
return ret
}
(( $+functions[_diskutil_APFS_subcommands] )) ||
_diskutil_APFS_subcommands() {
local -a commands=(
'list:Display APFS objects as a tree'
'convert:Convert an HFS volume to an APFS Container with a single APFS Volume'
'create:Create an empty APFS Container and add one APFS Volume with the given name'
'createContainer:Create an empty APFS Container'
'deleteContainer:Destroy an existing APFS Container'
'resizeContainer:Resize an existing APFS Container'
'addVolume:Add a new APFS Volume to an existing APFS Container'
'deleteVolume:Remove the given APFS Volume from its APFS Container'
'deleteVolumeGroup:Remove all APFS Volumes from the APFS Container'
'eraseVolume:Erase the contents of an existing APFS Volume'
'changeVolumeRole:Change the role metadata flags of an existing APFS Volume'
'unlockVolume:Unlock the mount an encrypted and locked APFS Volume or verify a passphrase'
'lockVolume:Unmount and lock an encrypted unlocked APFS Volume'
'listCryptoUsers:Show all cryptographic users and special-purpose users'
'changePassphrase:Change the passphrase of the user associated with the given APFS Volume'
'setPassphraseHint:Set an arbitrary hint string to aid recall of a passphrase'
'encryptVolume:Start encryption of a currently-unencrypted APFS Volume'
'decryptVolume:Start decryption of a currently-encrypted APFS Volume'
'listSnapshots:Show all APFS Snapshots associated with the given APFS Volume'
'deleteSnapshot:Remove the given APFS Snapshot from its APFS Volume'
'listGroups:Display the relationships among APFS Volumes which are defined by APFS Volume Groups'
'defragment:Manage automatic background defragmentation at the APFS Container or Volume level'
"updatePreboot:Update the target volume's associated Preboot Volume"
'syncPatchUsers:Perform a specific repair of APFS cryptographic user lock records'
)
_describe -t commands 'command' commands "$@"
}
(( $+functions[_diskutil_appleRAID] )) ||
_diskutil_appleRAID() {
local ret=1
_arguments -C \
'1: :_diskutil_appleRAID_subcommands' \
'*:: :->arg' \
&& ret=0
case $state in
(arg)
case $words[1] in
(list)
_arguments \
'-plist[emit a property list instead of user-formatted output]' \
'*:: :_files' \
&& ret=0
;;
(create)
_arguments \
'1:command:(mirror stripe concat)' \
'*:: :_files' \
&& ret=0
;;
(add)
_arguments \
'1:type:(member spare)' \
'*:: :_files' \
&& ret=0
;;
(enable)
_arguments \
'1:command:(mirror concat)' \
'*:: :_files' \
&& ret=0
;;
(update)
_arguments \
'1:key:(AutoRebuild SetTimeout)' \
'2:value' \
'*:: :_files' \
&& ret=0
;;
esac
;;
esac
return ret
}
(( $+functions[_diskutil_appleRAID_subcommands] )) ||
_diskutil_appleRAID_subcommands() {
local -a commands=(
'list:Display AppleRAID volumes with current status and associated member disks'
'create:Create a new RAID set consisting of multiple disks and/or RAID sets'
'delete:Destroy an existing RAID set'
'repairMirror:Repair a degraded mirror'
'add:Add a new member or hot spare to an existing RAID set'
'remove:Remove a member or spare from an existing RAID set'
'enable:Convert a non-RAID disk partition into an RAID set'
'update:Update the key-value parameters of an existing RAID set'
)
_describe -t commands 'command' commands "$@"
}
(( $+functions[_diskutil_corestorage] )) ||
_diskutil_corestorage() {
local ret=1
_arguments -C \
'1: :_diskutil_corestorage_subcommands' \
'*:: :->arg' \
&& ret=0
case $state in
(arg)
case $words[1] in
(list|info)
_arguments \
'-plist[emit property list instead of the formatted tree output]' \
'*:: :_files' \
&& ret=0
;;
(unlockVolume)
_arguments \
'-nomount[not mount automatically]' \
'-stdinpassphrase[read password from standard input]' \
'-passphrase[passphrase]:passphrase' \
'-recoverykeychain[a path to keychain file]:file:_files' \
'*:: :_files' \
&& ret=0
;;
esac
;;
esac
return ret
}
(( $+functions[_diskutil_corestorage_subcommands] )) ||
_diskutil_corestorage_subcommands() {
local -a commands=(
'list:Display a tree view of the CoreStorage world'
'info:Display properties of the CoreStorage object'
'delete:Delete a CoreStorage logical volume group'
'unlockVolume:Unlock a logical volume and file system'
)
_describe -t commands 'command' commands "$@"
}
(( $+functions[_diskutil_image] )) ||
_diskutil_image() {
local ret=1
_arguments -C \
'--stdinpassphrase[read the passphrase from stdin]' \
'--verbose[enable verbose output]' \
'--plist[produce output in a plist format]' \
'1: :_diskutil_image_subcommands' \
'*:: :->arg' \
&& ret=0
case $state in
(arg)
case $words[1] in
(attach)
_arguments \
'--readOnly[disk image is attached read-only]' \
'--nobrowse[hide the mounted volume in the disk image from GUI applications]' \
'--mountPoint[path to mount the image]:mount_point:_files -/' \
'--mountOptions[comma separated mount options]:option' \
'--mountPolicy[mount policy]:policy:(noMount autoMount forceMount)' \
'--noMount[skip any mount attempts and only attach the disk image]' \
'*--shadow[shadow file path]:file:_files' \
'*:: :_files' \
&& ret=0
;;
(info)
_arguments \
'--extra[additional information will be retrieved for some image types]' \
&& ret=0
;;
(create)
_diskutil_image_create && ret=0
;;
(resize)
_arguments \
'(-s --size)'{-s,--size}'[new size of the disk image]:size' \
'--image-only[only resize the disk image and adjust a secondary GPT table to the new size]' \
&& ret=0
;;
esac
;;
esac
return ret
}
(( $+functions[_diskutil_image_subcommands] )) ||
_diskutil_image_subcommands() {
local -a commands=(
'attach:Attach a disk image as a device'
'info:Print out information includes about a disk image'
'chpass:Change the passphrase of a given encrypted image'
'create:Create a disk image'
'resize:Resizes an existing disk image represented by given URL'
)
_describe -t commands 'command' commands "$@"
}
(( $+functions[_diskutil_image_create] )) ||
_diskutil_image_create() {
local ret=1
_arguments -C \
'1: :_diskutil_image_create_subcommands' \
'*:: :->arg' \
&& ret=0
case $state in
(arg)
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)' \
'*:: :_files' \
&& ret=0
;;
(from)
_arguments \
'--format[disk format]:format:(RAW UDRO UDZO ULFO ULMO ASIF UDSB)' \
'--shadow[path to the shadow file]:path:_files' \
'*:: :_files' \
&& ret=0
;;
esac
;;
esac
return ret
}
(( $+functions[_diskutil_image_create_subcommands] )) ||
_diskutil_image_create_subcommands() {
local -a commands=(
'blank:create a blank disk image'
'from:create a disk image from source'
)
_describe -t commands 'command' commands "$@"
}
_diskutil "$@"
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

1522
src/_ghc

File diff suppressed because it is too large Load Diff