diff options
author | Oliver Kiddle <opk@zsh.org> | 2017-10-29 13:42:53 +0100 |
---|---|---|
committer | Oliver Kiddle <opk@zsh.org> | 2017-10-29 13:42:53 +0100 |
commit | 01523f41450d97ebf2bc2e57ed27af0b3524f222 (patch) | |
tree | e72fb9f881ca4ec77483787a9bca4c5bc6bd8b20 /Completion/Unix/Command/_hexdump | |
parent | 85e56b5a48a2d83736fa367173fab4173551c8cf (diff) | |
download | zsh-01523f41450d97ebf2bc2e57ed27af0b3524f222.tar.gz zsh-01523f41450d97ebf2bc2e57ed27af0b3524f222.tar.xz zsh-01523f41450d97ebf2bc2e57ed27af0b3524f222.zip |
41958: update util-linux completions to 2.31; new hexdump completion
Diffstat (limited to 'Completion/Unix/Command/_hexdump')
-rw-r--r-- | Completion/Unix/Command/_hexdump | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Completion/Unix/Command/_hexdump b/Completion/Unix/Command/_hexdump new file mode 100644 index 000000000..f700ca683 --- /dev/null +++ b/Completion/Unix/Command/_hexdump @@ -0,0 +1,35 @@ +#compdef hexdump hd + +local -a args fmts optpar +fmts=( + {--one-byte-octal,-b}'[one-byte octal display]' + {--one-byte-char,-c}'[one-byte character display]' + {--two-bytes-decimal,-d}'[two-byte decimal display]' + {--two-bytes-octal,-o}'[two-byte octal display]' + {--two-bytes-hex,-x}'[two-byte hexadecimal display]' + {--format=,-e+}'[specify format string to be used for displaying data]:format' + {--format-file=,-f+}'[specify file that contains format strings]:file:_files' +) +args=( + '(H -n --length)'{--length=,-n+}'[interpret only specified amount of input]:length (bytes)' + '(H -s --skip)'{--skip=,-s+}'[skip specified bytes at the beginning]:offset (bytes)' + '(H -v --no-squeezing)'{--no-squeezing,-v}'[output identical lines]' +) + +[[ $service = hexdump ]] && fmts+=( {--canonical,-C}'[canonical hex+ASCII display]' ) + +if [[ $OSTYPE = linux* ]]; then + args+=( + '(-L --color)'{-L+,--color=}'[interpret color formatting specifiers colors are enabled by default]:mode' + + H + '(- *)'{-h,--help}'[display usage information]' + '(- *)'{-V,--version}'[display version information]' + ) +else + # strip long options by taking every second element + print -v fmts -f '%2$s' -- "$fmts[@]" + print -v args -f '%2$s' -- "$args[@]" + optpar=( -A "-*" ) +fi + +_arguments -s -S $optpar '*:file:_files' $args + '(formats)' '(H)'$^fmts |