public CoconaCompletionCandidatesMetadata( CompletionCandidateType candidateType, Type candidatesProviderType, CommandArgumentDescriptor commandArgument ) { CandidateType = candidateType; CandidatesProviderType = candidatesProviderType; ParameterType = commandArgument.ArgumentType; ParameterAttributes = commandArgument.ParameterAttributes; CommandOption = null; CommandArgument = commandArgument; }
/// <summary> /// Initialize a new instance of the <see cref="CompletionCandidatesAttribute"/> class with a specified <see cref="CompletionCandidateType"/>. /// </summary> /// <param name="candidateType">The candidate type of the parameter.</param> public CompletionCandidatesAttribute(CompletionCandidateType candidateType) { switch (candidateType) { case CompletionCandidateType.Default: case CompletionCandidateType.File: case CompletionCandidateType.Directory: break; default: throw new InvalidOperationException($"CompletionCandidateType '{candidateType}' requires a custom provider type."); } _candidates = Array.Empty <CompletionCandidateValue>(); CandidateType = candidateType; CandidatesProviderType = typeof(StaticCompletionCandidatesProvider); }