Author: jacob
Date: 2007-02-28 09:39:53 -0600 (Wed, 28 Feb 2007)
New Revision: 4646
Modified:
django/trunk/extras/django_bash_completion
Log:
Fixed #1240: added better support for different names for "python" to
django_bash_completion. Thanks, paolo.
Modified: django/trunk/extras/django_bash_completion
===================================================================
--- django/trunk/extras/django_bash_completion 2007-02-28 15:24:05 UTC (rev
4645)
+++ django/trunk/extras/django_bash_completion 2007-02-28 15:39:53 UTC (rev
4646)
@@ -31,6 +31,9 @@
#
# To uninstall, just remove the line from your .bash_profile and .bashrc.
+# Enable extended pattern matching operators.
+shopt -s extglob
+
_django_completion()
{
local cur prev opts actions action_shell_opts action_runfcgi_opts
@@ -58,8 +61,13 @@
||
# python manage.py, /some/path/python manage.py (if manage.py exists)
( ${COMP_CWORD} -eq 2 &&
- ( $( basename ${COMP_WORDS[0]} ) == python ) &&
+ ( $( basename ${COMP_WORDS[0]} ) == python?([1-9]\.[0-9]) ) &&
( $( basename ${COMP_WORDS[1]} ) == manage.py) &&
+ ( -r ${COMP_WORDS[1]} ) )
+ ||
+ ( ${COMP_CWORD} -eq 2 &&
+ ( $( basename ${COMP_WORDS[0]} ) == python?([1-9]\.[0-9]) ) &&
+ ( $( basename ${COMP_WORDS[1]} ) == django-admin.py) &&
( -r ${COMP_WORDS[1]} ) ) ]] ; then
case ${cur} in
@@ -135,3 +143,17 @@
}
complete -F _django_completion django-admin.py manage.py
+
+# Support for multiple interpreters.
+unset pythons
+if command -v whereis &>/dev/null; then
+ python_interpreters=$(whereis -b python | cut -d " " -f 2-)
+ for python in $python_interpreters; do
+ pythons="${pythons} $(basename $python)"
+ done
+ pythons=$(echo $pythons | tr " " "\n" | sort -u | tr "\n" " ")
+else
+ pythons=python
+fi
+
+complete -F _django_completion -o default $pythons
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---