Ask also which table(s) to enumerate from when --dump and -C are provided (but not -T) and minor layout adjustment

This commit is contained in:
Bernardo Damele 2010-01-09 21:39:10 +00:00
parent 12f371cd65
commit ef1180c3c2

View File

@ -1141,11 +1141,11 @@ class Enumeration:
message = "do you want to dump entries? [Y/n] " message = "do you want to dump entries? [Y/n] "
output = readInput(message, default="Y") output = readInput(message, default="Y")
if output not in ("y", "Y"): if output and output[0] not in ("y", "Y"):
return return
dumpFromDbs = [] dumpFromDbs = []
message = "which database?\n[a]ll (default)\n" message = "which database(s)?\n[a]ll (default)\n"
for db in dbs: for db in dbs:
message += "[%s]\n" % db message += "[%s]\n" % db
@ -1153,10 +1153,10 @@ class Enumeration:
message += "[q]uit" message += "[q]uit"
test = readInput(message, default="a") test = readInput(message, default="a")
if not test or test[0] in ("a", "A"): if not test or test in ("a", "A"):
dumpFromDbs = dbs.keys() dumpFromDbs = dbs.keys()
elif test[0] in ("q", "Q"): elif test in ("q", "Q"):
return return
else: else:
@ -1167,8 +1167,33 @@ class Enumeration:
continue continue
conf.db = db conf.db = db
dumpFromTbls = []
message = "which table(s) of database '%s'?\n" % db
message += "[a]ll (default)\n"
for tbl in tblData:
message += "[%s]\n" % tbl
message += "[s]kip\n"
message += "[q]uit"
test = readInput(message, default="a")
if not test or test in ("a", "A"):
dumpFromTbls = tblData
elif test in ("s", "S"):
continue
elif test in ("q", "Q"):
return
else:
dumpFromTbls = test.replace(" ", "").split(",")
for table, columns in tblData.items(): for table, columns in tblData.items():
if table not in dumpFromTbls:
continue
conf.tbl = table conf.tbl = table
conf.col = ",".join(column for column in columns) conf.col = ",".join(column for column in columns)
kb.data.cachedColumns = {} kb.data.cachedColumns = {}