protected internal IReadOnlyDictionary <string, PromptCmdlet> GetCmdlets(PromptCmdletContext context) { const string CmdletsKey = "Prompt.Cmdlets"; IReadOnlyDictionary <string, PromptCmdlet> cmdlets; if (!this.UseDynamicCmdlets) { if (!context.Annotations.TryGetValue(CmdletsKey, out var storedCmdlets)) { storedCmdlets = CreateCmdlets(context); context.Annotations[CmdletsKey] = storedCmdlets; } cmdlets = (IReadOnlyDictionary <string, PromptCmdlet>)storedCmdlets; } else { cmdlets = CreateCmdlets(context); } return(cmdlets); }
protected virtual IReadOnlyDictionary <string, PromptCmdlet> CreateCmdlets(PromptCmdletContext context) { return(new Dictionary <string, PromptCmdlet>(StringComparer.OrdinalIgnoreCase)); }
protected virtual string GetPromptText(PromptCmdletContext context) { return(">"); }
public sealed override Task <PromptCmdletResult> ExecuteAsync(PromptCmdletContext context, params string[] args) { return(ExecuteAsync((TContext)context, args)); }
protected sealed override IReadOnlyDictionary <string, PromptCmdlet> CreateCmdlets(PromptCmdletContext context) { return(CreateCmdlets((TContext)context)); }
protected sealed override string GetPromptText(PromptCmdletContext context) { return(GetPromptText((TContext)context)); }
public abstract Task <PromptCmdletResult> ExecuteAsync(PromptCmdletContext context, params string[] args);