1
0
mirror of https://github.com/chubin/cheat.sh.git synced 2026-06-20 13:16:44 +02:00

refactor tldr_update so it fits in two lines. abrstracted logic away into a function.

This commit is contained in:
Luciano Strika
2018-07-14 00:42:30 -03:00
parent 54f83fd747
commit 575054760f
+6 -6
View File
@@ -56,13 +56,13 @@ INTERNAL_TOPICS = [
':share',
]
def _get_filenames():
return [os.path.split(topic)[1] for topic in glob.glob(PATH_TLDR_PAGES)]
def _update_tldr_topics():
answer = []
for topic in glob.glob(PATH_TLDR_PAGES):
_, filename = os.path.split(topic)
if filename.endswith('.md'):
answer.append(filename[:-3])
return answer
return [ filename[:-3] for filename in _get_filenames() if filename.endswith('.md') ]
TLDR_TOPICS = _update_tldr_topics()
def _update_cheat_topics():