public static void PrepareTabLookup(Dictionary <string, object> dict, string currentIns, string helpText) { // Update help text. ConsoleTrack.helpText = helpText; // Make sure you're on the last instruction, otherwise no tab lookup applies. if (!ConsoleTrack.OnLastInstruction()) { return; } if (currentIns.Length > 0) { // Scan for instructions that start with the arg provided: string tab = dict.Where(pv => pv.Key.StartsWith(currentIns)).FirstOrDefault().Key; // Update the tab lookup. ConsoleTrack.tabLookup = tab != null?Regex.Replace(tab, "^" + currentIns, "") : string.Empty; } else { ConsoleTrack.tabLookup = string.Empty; } // Update possible tabs. ConsoleTrack.possibleTabs = "Options: " + String.Join(", ", dict.Keys.ToArray()); }