haiku/data/etc/bash_completion.d/screen
Brecht Machiels 4a135b33b7 * upgraded bash_completion to v1.3
* upgraded to subversion bash completion script shipped with subversion 1.6.17
* added git bash completion script shipped with git 1.7.5.4
* readded bash completion to the image

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42257 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-06-19 21:19:36 +00:00

67 lines
1.4 KiB
Bash

# bash completion for screen
have screen &&
_screen_sessions()
{
COMPREPLY=( $( compgen -W "$( command screen -ls | sed -ne \
's|^\t\{1,\}\([0-9]\{1,\}\.[^\t]\{1,\}\).*'"$1"'.*$|\1|p' )" \
-- "$cur" ) )
} &&
_screen()
{
local cur prev words cword
COMPREPLY=()
_get_comp_words_by_ref cur prev words cword
if ((cword > 2)); then
case ${words[cword-2]} in
-[dD])
_screen_sessions
return 0
;;
esac
fi
case $prev in
-[rR])
# list detached
_screen_sessions 'Detached'
return 0
;;
-[dD])
# list attached
_screen_sessions 'Attached'
return 0
;;
-x)
# list both
_screen_sessions
return 0
;;
-s)
_shells
return 0
;;
-c)
_filedir
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 \
--version' -- "$cur" ) )
fi
} &&
complete -F _screen -o default screen
# 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