File tree 1 file changed +13
-6
lines changed
1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -305,17 +305,24 @@ def get_page(
305
305
PARAM_REGEX = re .compile (r'(?:{{)(?P<param>.+?)(?:}})' )
306
306
307
307
308
- def get_commands (platforms : Optional [List [str ]] = None ) -> List [str ]:
308
+ def get_commands (platforms : Optional [List [str ]] = None , language : Optional [ str ] = None ) -> List [str ]:
309
309
if platforms is None :
310
310
platforms = get_platform_list ()
311
311
312
+ if language :
313
+ languages = [get_language_code (language [0 ])]
314
+ else :
315
+ languages = get_language_list ()
316
+
312
317
commands = []
313
318
if get_cache_dir ().exists ():
314
319
for platform in platforms :
315
- path = get_cache_dir () / 'pages' / platform
316
- if not path .exists ():
317
- continue
318
- commands += [file .stem for file in path .iterdir () if file .suffix == '.md' ]
320
+ for language in languages :
321
+ pages_dir = f'pages.{ language } ' if language != 'en' else 'pages'
322
+ path = get_cache_dir () / pages_dir / platform
323
+ if not path .exists ():
324
+ continue
325
+ commands += [file .stem for file in path .iterdir () if file .suffix == '.md' ]
319
326
return commands
320
327
321
328
@@ -511,7 +518,7 @@ def main() -> None:
511
518
parser .print_help (sys .stderr )
512
519
sys .exit (1 )
513
520
if options .list :
514
- print ('\n ' .join (get_commands (options .platform )))
521
+ print ('\n ' .join (get_commands (options .platform , options . language )))
515
522
elif options .render :
516
523
for command in options .command :
517
524
if Path (command ).exists ():
You can’t perform that action at this time.
0 commit comments