Add mktemp(1) completion.

master
Ville Skyttä 2011-01-24 00:20:32 +02:00
parent 25df309263
commit 74128a73ce
4 changed files with 52 additions and 3 deletions

View File

@ -13,9 +13,9 @@ bash-completion (2.x)
[ Ville Skyttä ]
* Activate hping2 completion also for hping and hping3.
* Add badblocks, compgen, crontab, dumpe2fs, e2freefrag, e2label, ether-wake,
filefrag, growisofs, iftop, ip (Debian: #600617), lrzip, lsof, portecle,
POSIX sh, sha{,224,256,384,512}sum, sysbench, tune2fs, xmodmap, and xrdb
completions.
filefrag, growisofs, iftop, ip (Debian: #600617), lrzip, lsof, mktemp,
portecle, POSIX sh, sha{,224,256,384,512}sum, sysbench, tune2fs, xmodmap,
and xrdb completions.
* Add *.gif (Alioth: #312512), *.m2t (Alioth: #312770), *.3gpp, *.3gpp2,
*.awb, and *.iso (Alioth: #311420) to mplayer filename completions.
* Add "short" tarball extensions to unxz, unlzma etc completions.

View File

@ -112,6 +112,34 @@ _id()
} &&
complete -F _id id
# mktemp(1) completion
#
have mktemp &&
_mktemp()
{
COMPREPLY=()
local cur prev split=false
_get_comp_words_by_ref cur prev
_split_longopt && split=true
case "$prev" in
--help|--version|--suffix)
return 0
;;
--tmpdir|-p)
_filedir -d
return 0
;;
esac
$split && return 0
[[ "$cur" == -* ]] && \
COMPREPLY=( $( compgen -W '-d -u -q -p -t' -- "$cur" ) )
} &&
complete -F _mktemp mktemp
# Local variables:
# mode: shell-script
# sh-basic-offset: 4

View File

@ -0,0 +1 @@
assert_source_completions mktemp

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}
proc teardown {} {
assert_env_unmodified
}
setup
assert_complete_any "mktemp -"
sync_after_int
teardown