Completion for theme names

This commit is contained in:
Kovid Goyal
2021-08-08 09:57:57 +05:30
parent e376c79dda
commit 80db2f6558
2 changed files with 16 additions and 2 deletions

View File

@@ -361,9 +361,14 @@ class Themes:
self.index_map = tuple(self.themes)
def load_themes(cache_age: float = 1.) -> Themes:
def load_themes(cache_age: float = 1., ignore_no_cache: bool = False) -> Themes:
ans = Themes()
ans.load_from_zip(fetch_themes(cache_age=cache_age))
try:
fetched = fetch_themes(cache_age=cache_age)
except NoCacheFound:
if not ignore_no_cache:
raise
ans.load_from_zip(fetched)
ans.load_from_dir(os.path.join(config_dir, 'themes'))
ans.index_map = tuple(ans.themes)
return ans