CLI: -l, -L, -t should match names with re patterns in them
This commit is contained in:
parent
8350859c0c
commit
8a6d766b06
@ -399,7 +399,9 @@ class ArgHandler(object):
|
||||
for name, dirname in sorted(self.dbman.family_tree_list(),
|
||||
key=lambda pair: pair[0].lower()):
|
||||
if (self.database_names is None or
|
||||
any([re.match("^" + dbname + "$", name) for dbname in self.database_names])):
|
||||
any([(re.match("^" + dbname + "$", name) or
|
||||
dbname == name)
|
||||
for dbname in self.database_names])):
|
||||
print(_("%(full_DB_path)s with name \"%(f_t_name)s\"")
|
||||
% {'full_DB_path' : dirname, 'f_t_name' : name})
|
||||
return
|
||||
|
@ -183,7 +183,9 @@ class CLIDbManager(object):
|
||||
(name, dirpath, path_name, last,
|
||||
tval, enable, stock_id, backend_type, version) = item
|
||||
if (database_names is None or
|
||||
any([re.match("^" + dbname + "$", name) for dbname in database_names])):
|
||||
any([(re.match("^" + dbname + "$", name) or
|
||||
dbname == name)
|
||||
for dbname in database_names])):
|
||||
summary = self.get_dbdir_summary(dirpath, name)
|
||||
print(_("Family Tree \"%s\":") % summary[_("Family Tree")])
|
||||
for item in sorted(summary):
|
||||
@ -203,7 +205,9 @@ class CLIDbManager(object):
|
||||
(name, dirpath, path_name, last,
|
||||
tval, enable, stock_id, backend_type, version) = item
|
||||
if (database_names is None or
|
||||
any([re.match("^" + dbname + "$", name) for dbname in database_names])):
|
||||
any([(re.match("^" + dbname + "$", name) or
|
||||
dbname == name)
|
||||
for dbname in database_names])):
|
||||
retval = self.get_dbdir_summary(dirpath, name)
|
||||
summary_list.append( retval )
|
||||
return summary_list
|
||||
@ -409,7 +413,7 @@ class CLIDbManager(object):
|
||||
if os.path.isfile(path_name):
|
||||
with open(path_name, 'r', encoding='utf8') as file:
|
||||
name = file.readline().strip()
|
||||
if re.match("^" + dbname + "$", name):
|
||||
if re.match("^" + dbname + "$", name) or dbname == name:
|
||||
match_list.append((name, dirpath))
|
||||
if len(match_list) == 0:
|
||||
CLIDbManager.ERROR("Family tree not found",
|
||||
|
Loading…
Reference in New Issue
Block a user