public override IEnumerable <String> AutocompletionCandidates(IEnumerable <String> arguments) { if (arguments.Count() != 1) { return(new List <String>()); } return(Autocompletion.Candidates(arguments.ElementAt(0), Mod.AliveMods.Select(mod => mod.Name))); }
public override IEnumerable <String> AutocompletionCandidates(IEnumerable <String> arguments) { if (arguments.Count() != 1) { return(new List <String>()); } return(Autocompletion.Candidates(arguments.ElementAt(0), Shell.GetCommandNames())); }
/// <summary> /// Returns the auto-completion candidates for a given command. /// Depending on what is entered, it will either return command verbs /// or command-provided auto-completion candidates /// </summary> /// <param name="command">The current command [verb, arg1, arg2,...]</param> /// <returns>The auto-completion candidates for the last argument</returns> internal static IEnumerable <String> GetAutocompletionCandidates(IEnumerable <String> command) { if (!command.Any()) { return(new List <String>()); } String verb = command.ElementAt(0); if (command.Count() == 1) { return(Autocompletion.Candidates(verb, Registry.Keys)); } Command _command; if (Registry.TryGetValue(verb, out _command)) { return(_command.AutocompletionCandidates(command.Skip(1))); } return(new List <String>()); }