Skip to content

Commit

Permalink
zopfli: New completion.
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed Aug 23, 2013
1 parent 61d1d7d commit 2da4ee9
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 1 deletion.
3 changes: 2 additions & 1 deletion completions/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,8 @@ bashcomp_DATA = 2to3 \
xz \
xzdec \
ypmatch \
yum-arch
yum-arch \
zopfli

EXTRA_DIST = $(bashcomp_DATA) \
_mock _modules _nmcli _subversion _udevadm _yum _yum-utils
Expand Down
31 changes: 31 additions & 0 deletions completions/zopfli
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# bash completion for zopfli -*- shell-script -*-

_zopfli()
{
local cur prev words cword
_init_completion || return

case $prev in
-h)
return
;;
esac

if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W \
'$( _parse_help "$1" -h | sed -e "s/#$//" )' -- "$cur" ) )
[[ $COMPREPLY == --i ]] && compopt -o nospace
return
fi

local IFS=$'\n' xspec="*.@(gz|t[ag]z)"

_expand || return 0

compopt -o filenames
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
complete -F _zopfli zopfli

# ex: ts=4 sw=4 et filetype=sh
1 change: 1 addition & 0 deletions test/completion/zopfli.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
assert_source_completions zopfli
18 changes: 18 additions & 0 deletions test/lib/completions/zopfli.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
proc setup {} {
save_env
}


proc teardown {} {
assert_env_unmodified
}


setup


assert_complete_any "zopfli "
sync_after_int


teardown

0 comments on commit 2da4ee9

Please sign in to comment.