mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Fixed #26289 -- Enabled shell tab completion on systems using libedit.
This commit is contained in:
committed by
Tim Graham
parent
839a955d08
commit
6c33e73333
@@ -69,7 +69,13 @@ class Command(BaseCommand):
|
||||
# we already know 'readline' was imported successfully.
|
||||
import rlcompleter
|
||||
readline.set_completer(rlcompleter.Completer(imported_objects).complete)
|
||||
readline.parse_and_bind("tab:complete")
|
||||
# Enable tab completion on systems using libedit (e.g. Mac OSX).
|
||||
# These lines are copied from Lib/site.py on Python 3.4.
|
||||
readline_doc = getattr(readline, '__doc__', '')
|
||||
if readline_doc is not None and 'libedit' in readline_doc:
|
||||
readline.parse_and_bind("bind ^I rl_complete")
|
||||
else:
|
||||
readline.parse_and_bind("tab:complete")
|
||||
|
||||
# We want to honor both $PYTHONSTARTUP and .pythonrc.py, so follow system
|
||||
# conventions and get $PYTHONSTARTUP first then .pythonrc.py.
|
||||
|
||||
Reference in New Issue
Block a user