From e2aabac5759f82cb721496a465fb524af6c8956f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Tue, 23 Jan 2024 00:03:39 +0100 Subject: [PATCH] Help aliases --- .../decompiler/flash/console/CommandLineHelp.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/com/jpexs/decompiler/flash/console/CommandLineHelp.java b/src/com/jpexs/decompiler/flash/console/CommandLineHelp.java index 870d5312e..9e7acb5e6 100644 --- a/src/com/jpexs/decompiler/flash/console/CommandLineHelp.java +++ b/src/com/jpexs/decompiler/flash/console/CommandLineHelp.java @@ -40,6 +40,7 @@ public class CommandLineHelp { private static Map> commands = new LinkedHashMap<>(); private static Map preOptions = new LinkedHashMap<>(); private static String preface = null; + private static Map aliasMap = new HashMap<>(); static { parse(); @@ -272,6 +273,9 @@ public class CommandLineHelp { commands.put(itemName.toLowerCase(), new ArrayList<>()); } commands.get(itemName.toLowerCase()).add(new Command(itemName, customSynopsis, arguments, header, descriptionBuffer.toString(), aliases)); + for (String alias : aliases) { + aliasMap.put(alias.toLowerCase(), itemName.toLowerCase()); + } itemName = null; argumentsContinuation = false; } @@ -406,7 +410,14 @@ public class CommandLineHelp { out.println(opt.getHelp(true)); } out.println(); - } else { + } else { + + if (aliasMap.containsKey("-" + filter)) { + filter = aliasMap.get("-" + filter).substring(1); + } else if (aliasMap.containsKey(filter)) { + filter = aliasMap.get(filter).substring(1); + } + if (commands.containsKey("-" + filter.toLowerCase())) { boolean first = true; for (Command c : commands.get("-" + filter.toLowerCase())) {