diff options
author | Ville Skyttä <ville.skytta@iki.fi> | 2011-01-24 00:20:32 +0200 |
---|---|---|
committer | Ville Skyttä <ville.skytta@iki.fi> | 2011-01-24 00:20:32 +0200 |
commit | 74128a73ce3448574ca886c568d9c7f3e2c1c3e9 (patch) | |
tree | a97f1ae64f569bff57636ed62831f981ab70818d | |
parent | 25df3092630bde800e3d5d743aeac614e5216c10 (diff) | |
download | bash-completion-74128a73ce3448574ca886c568d9c7f3e2c1c3e9.tar.gz |
Add mktemp(1) completion.
-rw-r--r-- | CHANGES | 6 | ||||
-rw-r--r-- | completions/coreutils | 28 | ||||
-rw-r--r-- | test/completion/mktemp.exp | 1 | ||||
-rw-r--r-- | test/lib/completions/mktemp.exp | 20 |
4 files changed, 52 insertions, 3 deletions
@@ -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. diff --git a/completions/coreutils b/completions/coreutils index 299aabe0..33d58cf7 100644 --- a/completions/coreutils +++ b/completions/coreutils @@ -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 diff --git a/test/completion/mktemp.exp b/test/completion/mktemp.exp new file mode 100644 index 00000000..b8296865 --- /dev/null +++ b/test/completion/mktemp.exp @@ -0,0 +1 @@ +assert_source_completions mktemp diff --git a/test/lib/completions/mktemp.exp b/test/lib/completions/mktemp.exp new file mode 100644 index 00000000..8b0a3be2 --- /dev/null +++ b/test/lib/completions/mktemp.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "mktemp -" + + +sync_after_int + + +teardown |