diff options
author | Igor Murzov <e-mail@date.by> | 2011-12-18 21:59:15 +0400 |
---|---|---|
committer | Igor Murzov <e-mail@date.by> | 2011-12-18 21:59:15 +0400 |
commit | 5dba39cbd3283f1e127753b3d54a200a1ffecbd6 (patch) | |
tree | ba2a16b50c5c057c1dabe1eada957fc26a722626 | |
parent | bb5200695bf72b26df64ad65a13aee78df42dfe9 (diff) | |
download | bash-completion-5dba39cbd3283f1e127753b3d54a200a1ffecbd6.tar.gz |
htop: New completoin.
-rw-r--r-- | completions/Makefile.am | 1 | ||||
-rw-r--r-- | completions/htop | 32 | ||||
-rw-r--r-- | test/completion/htop.exp | 1 | ||||
-rw-r--r-- | test/lib/completions/htop.exp | 20 |
4 files changed, 54 insertions, 0 deletions
diff --git a/completions/Makefile.am b/completions/Makefile.am index 797fc88c..ea301709 100644 --- a/completions/Makefile.am +++ b/completions/Makefile.am @@ -114,6 +114,7 @@ bashcomp_DATA = a2x \ hddtemp \ hid2hci \ hping2 \ + htop \ htpasswd \ iconv \ id \ diff --git a/completions/htop b/completions/htop new file mode 100644 index 00000000..969eb397 --- /dev/null +++ b/completions/htop @@ -0,0 +1,32 @@ +# htop(1) completion -*- shell-script -*- + +_htop() +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + -s|--sort-key) + COMPREPLY=( $( compgen -W '$( "$1" -s help )' -- "$cur" ) ) + return + ;; + -u|--user) + _usergroup + return + ;; + -d|--delay) + # argument required but no completions available + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi +} && complete -F _htop htop + +# ex: ts=4 sw=4 et filetype=sh diff --git a/test/completion/htop.exp b/test/completion/htop.exp new file mode 100644 index 00000000..c5372475 --- /dev/null +++ b/test/completion/htop.exp @@ -0,0 +1 @@ +assert_source_completions htop diff --git a/test/lib/completions/htop.exp b/test/lib/completions/htop.exp new file mode 100644 index 00000000..d3e94d10 --- /dev/null +++ b/test/lib/completions/htop.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "htop -" + + +sync_after_int + + +teardown |