Add completion of locals to spack python (#29702)

This commit is contained in:
Jörg Behrmann
2022-03-30 22:38:39 +02:00
committed by GitHub
parent 20000493f3
commit 4571f4c994

View File

@@ -118,6 +118,10 @@ def python_interpreter(args):
else:
# Provides readline support, allowing user to use arrow keys
console.push('import readline')
# Provide tabcompletion
console.push('from rlcompleter import Completer')
console.push('readline.set_completer(Completer(locals()).complete)')
console.push('readline.parse_and_bind("tab: complete")')
console.interact("Spack version %s\nPython %s, %s %s"
% (spack.spack_version, platform.python_version(),