mirror of
https://github.com/openSUSE/osc.git
synced 2025-08-22 14:38:53 +02:00
Added readline support to cmdln-module.
This was already fixed in the original module: https://github.com/trentm/cmdln/issues/1 Signed-off-by: Florian Bergmann <fbergmann@suse.de>
This commit is contained in:
16
osc/cmdln.py
16
osc/cmdln.py
@@ -393,6 +393,15 @@ class RawCmdln(cmd.Cmd):
|
||||
"""
|
||||
self.cmdlooping = True
|
||||
self.preloop()
|
||||
if self.use_rawinput and self.completekey:
|
||||
try:
|
||||
import readline
|
||||
self.old_completer = readline.get_completer()
|
||||
readline.set_completer(self.complete)
|
||||
readline.parse_and_bind(self.completekey+": complete")
|
||||
except ImportError:
|
||||
pass
|
||||
try:
|
||||
if intro is None:
|
||||
intro = self.intro
|
||||
if intro:
|
||||
@@ -434,6 +443,13 @@ class RawCmdln(cmd.Cmd):
|
||||
retval = 1
|
||||
self.lastretval = retval
|
||||
self.postloop()
|
||||
finally:
|
||||
if self.use_rawinput and self.completekey:
|
||||
try:
|
||||
import readline
|
||||
readline.set_completer(self.old_completer)
|
||||
except ImportError:
|
||||
pass
|
||||
self.cmdlooping = False
|
||||
return retval
|
||||
|
||||
|
Reference in New Issue
Block a user