diff options
| author | dana <dana@dana.is> | 2018-06-04 10:04:27 -0500 |
|---|---|---|
| committer | Oliver Kiddle <okiddle@yahoo.co.uk> | 2018-06-07 18:19:55 +0200 |
| commit | 64ef1eddfd4fa79a0720945e189cf7c3a44bde9c (patch) | |
| tree | 9237ef4615c0643b783d5fac4f007f9cb4fc693d /Completion/Unix/Command/_md5sum | |
| parent | users/23434: initialise UNDO_LIMIT_NO so that an initial undo doesn't clear t... (diff) | |
| download | zsh-64ef1eddfd4fa79a0720945e189cf7c3a44bde9c.tar zsh-64ef1eddfd4fa79a0720945e189cf7c3a44bde9c.tar.gz zsh-64ef1eddfd4fa79a0720945e189cf7c3a44bde9c.tar.bz2 zsh-64ef1eddfd4fa79a0720945e189cf7c3a44bde9c.tar.lz zsh-64ef1eddfd4fa79a0720945e189cf7c3a44bde9c.tar.xz zsh-64ef1eddfd4fa79a0720945e189cf7c3a44bde9c.tar.zst zsh-64ef1eddfd4fa79a0720945e189cf7c3a44bde9c.zip | |
42931: completion for several utilities especially for checksums across a variety of systems
Diffstat (limited to 'Completion/Unix/Command/_md5sum')
| -rw-r--r-- | Completion/Unix/Command/_md5sum | 61 |
1 files changed, 47 insertions, 14 deletions
diff --git a/Completion/Unix/Command/_md5sum b/Completion/Unix/Command/_md5sum index 073e6beba..8e93fbbac 100644 --- a/Completion/Unix/Command/_md5sum +++ b/Completion/Unix/Command/_md5sum @@ -1,15 +1,48 @@ -#compdef md5sum gmd5sum +#compdef md5sum gmd5sum b2sum gb2sum sha1sum gsha1sum sha224sum gsha224sum sha256sum gsha256sum sha384sum gsha384sum sha512sum gsha512sum -_arguments -S \ - '(-b --binary)'{-b,--binary}'[read in binary mode]' \ - '(-c --check)'{-c,--check}'[read MD5 sums from the FILEs and check them]' \ - '--tag[create a BSD-style checksum]' \ - '(-t --text)'{-t,--text}'[read in text mode]' \ - "--ignore-missing[don't fail or report status for missing files]" \ - '(-q --quiet)'{-q,--quiet}"[don't print OK for each successfully verified file]" \ - '--status[no output, status code shows success]' \ - '--strict[exit non-zero for improperly formatted checksum lines]' \ - '(-w --warn)'{-w,--warn}'[warn about improperly formatted checksum lines]' \ - '(-)--help[display help and exit]' \ - '(-)--version[output version information and exit]' \ - '*:files:_files' +# This function covers the various digest utilities (which are all essentially +# the same program) from GNU Coreutils. It does NOT cover GNU `cksum` and `sum`, +# nor the various BSD digest utilities like `md5` and `sha1` — see `_cksum` for +# all of those. See `_shasum` for the `shasum` Perl script. +# +# @todo Support BusyBox? + +local type +local -a args + +case $service in + *md5*) type=MD5 ;; + *b2*) type=BLAKE2 ;; + *sha*) type=SHA${service//[^0-9]/} ;; +esac + +# General options +args+=( + '(: -)--help[display help information]' + '(: -)--version[display version information]' +) +# Summing options +args+=( + + sum + '(chk)--tag[create BSD-style checksums]' + '(chk -b -t --binary --text)'{-b,--binary}'[read in binary mode]' + '(chk -b -t --binary --text)'{-t,--text}'[read in text mode]' +) +# This is the only option that differs amongst all of these tools +[[ $service == *b2* ]] && args+=( + '(chk -l --length)'{-l+,--length=}'[specify digest length]:digest length (bits, multiples of 8)' +) +# Verification options +args+=( + + chk + '(sum -c --check)'{-c,--check}"[verify $type checksums from input files]" + "(sum)--ignore-missing[don't fail or report status for missing files]" + "(sum)--quiet[don't print OK for each verified file]" + '(sum -w --warn)--status[suppress all output]' + '(sum)--strict[exit non-zero for improperly formatted checksum lines]' + '(sum -w --status --warn)'{-w,--warn}'[warn about each improperly formatted checksum line]' +) +# Operands +args+=( '*: :_files' ) + +_arguments -s -S : $args |
