def view_reading_list(opts):
"""
get the current reading list
:param opts:
"""
if os.path.isfile(READING_LIST_ENTRY_FILE_PATH):
with open(READING_LIST_ENTRY_FILE_PATH) as reading_list_entry:
file_contents = yaml.load(reading_list_entry)
file_contents = dict(file_contents)
last_updated = time.ctime(os.path.getmtime(READING_LIST_ENTRY_FILE_PATH))
query = opts[1]
params = opts[0]
search = ''
if query != 'None':
search = "(filtered by " + params + ": " + query + ")"
filtered_contents = [article for article in file_contents['entries'] if
is_in_params(params, query, article)]
file_contents = dict(entries=filtered_contents)
chalk.blue("Your awesome reading list " + search)
chalk.blue("Last updated: " + last_updated)
print_reading_list(file_contents)
else:
empty_list_prompt()
评论列表
文章目录