[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 0f2656669fbdf627a3ddf11bdb72e3ec9cef68fd
Guillaume Rousse
guillomovitch at zarb.org
Mon Mar 30 20:05:40 UTC 2009
The following commit has been merged in the master branch:
commit 515beac77ebb06eb8684c2fb314294e29fa69dcc
Author: Guillaume Rousse <guillomovitch at zarb.org>
Date: Mon Mar 30 21:49:40 2009 +0200
split screen completion into its own file
diff --git a/contrib/screen b/contrib/screen
new file mode 100644
index 0000000..7996f4f
--- /dev/null
+++ b/contrib/screen
@@ -0,0 +1,47 @@
+# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
+# ex: ts=8 sw=8 noet filetype=sh
+#
+# bash completion for screen
+
+# screen(1) completion
+#
+have screen &&
+_screen()
+{
+ local cur prev preprev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ [ "$COMP_CWORD" -ge 2 ] && preprev=${COMP_WORDS[COMP_CWORD-2]}
+
+ if [ "$preprev" = "-d" -o "$preprev" = "-D" -a "$prev" = "-r" -o \
+ "$prev" = "-R" ]; then
+ # list all
+ COMPREPLY=( $( command screen -ls | \
+ sed -ne 's|^['$'\t'']\+\('$cur'[0-9]\+\.[^'$'\t'']\+\).*$|\1|p' ) )
+ else
+ case "$prev" in
+ -[rR])
+ # list detached
+ COMPREPLY=( $( command screen -ls | \
+ sed -ne 's|^['$'\t'']\+\('$cur'[0-9]\+\.[^'$'\t'']\+\).*Detached.*$|\1|p' ) )
+ ;;
+ -[dDx])
+ # list attached
+ COMPREPLY=( $( command screen -ls | \
+ sed -ne 's|^['$'\t'']\+\('$cur'[0-9]\+\.[^'$'\t'']\+\).*Attached.*$|\1|p' ) )
+ ;;
+ -s)
+ # shells
+ COMPREPLY=( $( grep ^${cur:-[^#]} /etc/shells ) )
+ ;;
+ *)
+ ;;
+ esac
+ fi
+
+ return 0
+} &&
+complete -F _screen $default screen
--
bash-completion
More information about the Bash-completion-commits
mailing list