Add --glob and --location flags to hist and question commands, to be able to specify the location and files they should use.
This commit is contained in:
@@ -325,7 +325,12 @@ class ChatDB(Chat):
|
||||
* 'mfilter': use with 'Message.from_file()' to filter messages
|
||||
when reading them.
|
||||
"""
|
||||
messages = read_dir(db_path, glob, mfilter)
|
||||
messages: list[Message] = []
|
||||
if loc in [msg_location.DB, msg_location.DISK, msg_location.ALL]:
|
||||
messages.extend(read_dir(db_path, glob, mfilter))
|
||||
if loc in [msg_location.CACHE, msg_location.DISK, msg_location.ALL]:
|
||||
messages.extend(read_dir(cache_path, glob, mfilter))
|
||||
messages.sort(key=lambda x: x.msg_id())
|
||||
return cls(messages, cache_path, db_path, mfilter, glob)
|
||||
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user