From c5b771749bd11bfaa31877136b896fd6cb0e5ee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Mon, 25 Apr 2011 15:19:48 +0300 Subject: [PATCH] Add _terms() and screen -T completion. --- CHANGES | 4 ++-- bash_completion | 10 ++++++++++ completions/screen | 6 +++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index dcbe1678..d720a456 100644 --- a/CHANGES +++ b/CHANGES @@ -2,8 +2,8 @@ bash-completion (2.x) [ Ville Skyttä ] * Add pxz and reptyr completions. - * Improve aspell, gendiff, rsync, smartctl, tar, xz, xzdec, and generic long - option completions. + * Improve aspell, gendiff, rsync, screen, smartctl, tar, xz, xzdec, and + generic long option completions. * Try harder to find the correct perl executable to run the perl helper with. * Drop rpm query support for rpm < 4.1. * Split rpm and rpmbuild completions and improve them both. diff --git a/bash_completion b/bash_completion index 44e8ed60..fe01ac2a 100644 --- a/bash_completion +++ b/bash_completion @@ -1227,6 +1227,16 @@ _dvd_devices() COMPREPLY+=( $( compgen -f -d -X "!*/?(r)dvd*" -- "${cur:-/dev/}" ) ) } +# TERM environment variable values +_terms() +{ + COMPREPLY+=( $( compgen -W \ + "$( sed -ne 's/^\([^[:space:]#|]\{2,\}\)|.*/\1/p' /etc/termcap \ + 2>/dev/null )" -- "$cur" ) ) + COMPREPLY+=( $( compgen -W "$( { toe -a 2>/dev/null || toe 2>/dev/null; } \ + | awk '{ print $1 }' | sort -u )" -- "$cur" ) ) +} + # a little help for FreeBSD ports users [ $UNAME = FreeBSD ] && complete -W 'index search fetch fetch-list extract \ patch configure build install reinstall deinstall clean clean-depends \ diff --git a/completions/screen b/completions/screen index e2d99bd4..7c405c33 100644 --- a/completions/screen +++ b/completions/screen @@ -46,11 +46,15 @@ _screen() _filedir return 0 ;; + -T) + _terms + return 0 + ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '-a -A -c -d -D -e -f -fn -fa -h -i -ln \ - -list -L -m -O -p -q -r -R -s -S -t -U -v -wipe -x -X --help \ + -list -L -m -O -p -q -r -R -s -S -t -T -U -v -wipe -x -X --help \ --version' -- "$cur" ) ) fi } &&