feat: suggest systems by short name

--system gba, psx or ps1 was refused with no suggestion on RetroArch.
Short names now suggest the ids they stand for, never taken in their
place, and two aliases of one system name it once. --platform muos and
the other systems --list-platforms names stand for the file list they
get, and the run says which.
This commit is contained in:
Abdessamad Derraz committed 2026-10-23 13:55:09 +02:00
1 parent 41839b7784
commit e041fac351
6 files changed
+104 -10

No files matched your search

+15
View File
@@ -3759,6 +3759,21 @@ class ATypoGetsTheClosestName(unittest.TestCase):
self.assertEqual(install.normalize_platform("RetroArch "), "retroarch")
self.assertEqual(install.normalize_platform("RetroDECK"), "retrodeck")
def test_a_system_name_stands_for_the_list_it_gets(self):
"""--list-platforms printed `muOS: retroarch`, and --platform muos
answered "Unknown platform"."""
for typed, plat in (("muos", "retroarch"), ("muOS", "retroarch"),
("ArkOS", "retroarch"), ("PAN4ELEC", "amberelec"),
("JELOS", "retroarch")):
out = io.StringIO()
with self.subTest(typed=typed), contextlib.redirect_stdout(out):
self.assertEqual(install.normalize_platform(typed), plat)
self.assertIn(f"--platform {plat}", out.getvalue())
def test_a_system_that_gets_no_list_is_still_refused(self):
with contextlib.redirect_stderr(io.StringIO()), self.assertRaises(SystemExit):
install.normalize_platform("TrimUI")
def test_a_platform_typo_is_answered_with_one_name(self):
err = io.StringIO()
with contextlib.redirect_stderr(err), self.assertRaises(SystemExit) as raised: