mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-27 03:48:52 -06:00
refactor: name the listing options once
Eight places tested the five --list-* options by hand, and four lists named them. One table and one function now say which a run gave, so a sixth listing is one line.
This commit is contained in:
1 parent
9a27d0b574
commit
8ecd102c77
8 files changed
+66
-61
No files matched your search
@@ -35,6 +35,18 @@ _COMMAND_ORDER = (
|
||||
)
|
||||
|
||||
|
||||
# The options that print a list and install nothing, in the order a run
|
||||
# names them.
|
||||
LISTING_FLAGS = (("--list-platforms", "list_platforms"), ("--list-targets", "list_targets"),
|
||||
("--list-systems", "list_systems"), ("--list-cores", "list_cores"),
|
||||
("--list-emulators", "list_emulators"))
|
||||
|
||||
|
||||
def listings_given(args: argparse.Namespace) -> list[str]:
|
||||
"""The listing options of a run, as typed."""
|
||||
return [flag for flag, attr in LISTING_FLAGS if getattr(args, attr)]
|
||||
|
||||
|
||||
def _command_rank(option: tuple[str, str | None]) -> int:
|
||||
flag = option[0]
|
||||
return _COMMAND_ORDER.index(flag) if flag in _COMMAND_ORDER else len(_COMMAND_ORDER)
|
||||
|
||||
Reference in new issue
Block a user