pwgen: New completion.
This commit is contained in:
parent
102a19c8a2
commit
1daff31f2e
@ -129,6 +129,7 @@ bashcomp_DATA = abook \
|
|||||||
procps \
|
procps \
|
||||||
protoc \
|
protoc \
|
||||||
puppet \
|
puppet \
|
||||||
|
pwgen \
|
||||||
python \
|
python \
|
||||||
qdbus \
|
qdbus \
|
||||||
qemu \
|
qemu \
|
||||||
|
34
completions/pwgen
Normal file
34
completions/pwgen
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
have pwgen || return
|
||||||
|
|
||||||
|
_pwgen()
|
||||||
|
{
|
||||||
|
local cur prev words cword split
|
||||||
|
_init_completion -s || return
|
||||||
|
|
||||||
|
case $prev in
|
||||||
|
-N|--num-passwords|-h|--help)
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
-H|--sha1)
|
||||||
|
_filedir
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
$split && return
|
||||||
|
|
||||||
|
if [[ $cur == -* ]]; then
|
||||||
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||||
|
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
} &&
|
||||||
|
complete -F _pwgen pwgen
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# mode: shell-script
|
||||||
|
# sh-basic-offset: 4
|
||||||
|
# sh-indent-comment: t
|
||||||
|
# indent-tabs-mode: nil
|
||||||
|
# End:
|
||||||
|
# ex: ts=4 sw=4 et filetype=sh
|
1
test/completion/pwgen.exp
Normal file
1
test/completion/pwgen.exp
Normal file
@ -0,0 +1 @@
|
|||||||
|
assert_source_completions pwgen
|
20
test/lib/completions/pwgen.exp
Normal file
20
test/lib/completions/pwgen.exp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
proc setup {} {
|
||||||
|
save_env
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
proc teardown {} {
|
||||||
|
assert_env_unmodified
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
setup
|
||||||
|
|
||||||
|
|
||||||
|
assert_complete_any "pwgen -"
|
||||||
|
|
||||||
|
|
||||||
|
sync_after_int
|
||||||
|
|
||||||
|
|
||||||
|
teardown
|
Loading…
x
Reference in New Issue
Block a user