@@ -305,17 +305,27 @@ 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 ,
309
+ language : Optional [str ] = None ) -> List [str ]:
309
310
if platforms is None :
310
311
platforms = get_platform_list ()
311
312
313
+ if language :
314
+ languages = [get_language_code (language [0 ])]
315
+ else :
316
+ languages = get_language_list ()
317
+
312
318
commands = []
313
319
if get_cache_dir ().exists ():
314
320
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' ]
321
+ for language in languages :
322
+ pages_dir = f'pages.{ language } ' if language != 'en' else 'pages'
323
+ path = get_cache_dir () / pages_dir / platform
324
+ if not path .exists ():
325
+ continue
326
+ commands += [f"{ file .stem } ({ language } )"
327
+ for file in path .iterdir ()
328
+ if file .suffix == '.md' ]
319
329
return commands
320
330
321
331
@@ -511,7 +521,7 @@ def main() -> None:
511
521
parser .print_help (sys .stderr )
512
522
sys .exit (1 )
513
523
if options .list :
514
- print ('\n ' .join (get_commands (options .platform )))
524
+ print ('\n ' .join (get_commands (options .platform , options . language )))
515
525
elif options .render :
516
526
for command in options .command :
517
527
if Path (command ).exists ():
0 commit comments