/
githubmirror
/
bash-completion
Обзор
Документация
Войти
/
githubmirror
/
bash-completion
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
1.3
completions/screen
66 строк
1 KB
Ville Skyttä
Simplify _screen_sessions(), use compgen -W, fixes partial completion.
05 ноя 2010, 22:28
05 ноя 2010, 22:28
b7937bf
Код
Авторство
О чём код?
# 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