public override string[] GetCompletions(CommandCompletionContext completionContext)
        {
            var descriptor = completionContext.MemberDescriptor;
            var properties = completionContext.Properties;

            if (descriptor.DescriptorName == nameof(CommandNames))
            {
                var commandNames = new string[] { };
                if (properties.TryGetValue(nameof(CommandNames), out var value) == true)
                {
                    commandNames = value as string[];
                }
                return(this.GetCommandNames(this.CommandContext.Node, commandNames, completionContext.Find));
            }
            return(base.GetCompletions(completionContext));
        }
 private string[] GetCompletion(ICommand item, string[] args, string find)
 {
     if (item is ICommandCompletor completor)
     {
         var members = CommandDescriptor.GetMemberDescriptors(item);
         var context = CommandCompletionContext.Create(item, members, args, find);
         if (context is CommandCompletionContext completionContext)
         {
             var completion = completor.GetCompletions(completionContext);
             if (completion != null)
             {
                 return(completion);
             }
         }
         else if (context is string[] completions)
         {
             return(completions);
         }
     }
     return(null);
 }
Пример #3
0
 public string[] GetCompletions(CommandCompletionContext completionContext)
 {
     return(this.command.GetCompletions(this.descriptor, completionContext.MemberDescriptor, completionContext.Find));
 }
 public virtual string[] GetCompletions(CommandCompletionContext completionContext)
 {
     return(null);
 }