ability to enter the backend name
This commit is contained in:
parent
22bcc77058
commit
090fb38feb
1 changed files with 12 additions and 5 deletions
|
|
@ -175,11 +175,18 @@ class ReplApplication(Cmd, ConsoleApplication):
|
||||||
for index, (name, backend) in enumerate(e.backends):
|
for index, (name, backend) in enumerate(e.backends):
|
||||||
print '%s%d)%s %s%-15s%s %s' % (self.BOLD, index + 1, self.NC, self.BOLD, name, self.NC,
|
print '%s%d)%s %s%-15s%s %s' % (self.BOLD, index + 1, self.NC, self.BOLD, name, self.NC,
|
||||||
backend.DESCRIPTION)
|
backend.DESCRIPTION)
|
||||||
i = int(self.ask('Select a backend to proceed', regexp='^\d+$'))
|
i = self.ask('Select a backend to proceed with "%s"' % id)
|
||||||
if i < 0 or i > len(e.backends):
|
if not i.isdigit():
|
||||||
print >>sys.stderr, 'Error: %s is not a valid choice' % i
|
if not i in dict(e.backends):
|
||||||
continue
|
print >>sys.stderr, 'Error: %s is not a valid backend' % i
|
||||||
backend_name = e.backends[i-1][0]
|
continue
|
||||||
|
backend_name = i
|
||||||
|
else:
|
||||||
|
i = int(i)
|
||||||
|
if i < 0 or i > len(e.backends):
|
||||||
|
print >>sys.stderr, 'Error: %s is not a valid choice' % i
|
||||||
|
continue
|
||||||
|
backend_name = e.backends[i-1][0]
|
||||||
|
|
||||||
return id, backend_name
|
return id, backend_name
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue