Skip to content

Instantly share code, notes, and snippets.

@oflow
Created February 15, 2017 06:33
Show Gist options
  • Save oflow/4b70b8efdcd8dd43705b9a5c0868134b to your computer and use it in GitHub Desktop.
Save oflow/4b70b8efdcd8dd43705b9a5c0868134b to your computer and use it in GitHub Desktop.
雑なzopfli補完
compdef _zopfli zopfli
function _zopfli() {
_arguments \
'-h[help]' \
'-c[write the result on standard output]' \
'-v[verbose mode]' \
'--i#[perform # iterations (default 15). Expamples --i50]' \
'--gzip[output to gzip format (default)]' \
'--zlib[output to zlib format]' \
'--deflate[output to deflate format]' \
'--splitlast[do block splitting last instead of first]' \
'*:key:__zopfli'
__zopfli() {
local -a iterations
if [ "$(echo "${words[@]}" | grep " --i")" ]; then
iterations=(
'--'
'--i15'
'--i20'
'--i50'
'--i100'
'--i200'
)
_wanted key expl 'iterations' compadd $iterations
else
_wanted key expl 'files' _files
fi
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment