Exemplo n.º 1
0
 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)));
 }
Exemplo n.º 2
0
 public override IEnumerable <String> AutocompletionCandidates(IEnumerable <String> arguments)
 {
     if (arguments.Count() != 1)
     {
         return(new List <String>());
     }
     return(Autocompletion.Candidates(arguments.ElementAt(0), Shell.GetCommandNames()));
 }
Exemplo n.º 3
0
        /// <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>());
        }