public bool TryComplete(TabCompletionContext context, out string completion) { if (actionSource == null) { actionSource = new SimpleTabCompletionSource(FindActions(context.Definition)) { MinCharsBeforeCyclingBegins = 0 }; globalArgumentSource = new SimpleTabCompletionSource(FindGlobalArguments(context.Definition)) { MinCharsBeforeCyclingBegins = 0 }; actionSpecificArgumentSources = FindActionSpecificSources(context.Definition); } // if this is the first token and the definition contains actions then try to auto complete an action name if (string.IsNullOrEmpty(context.PreviousToken) && context.Definition.Actions.Count > 0) { return(actionSource.TryComplete(context, out completion)); } // if there is no action in context and no argument in context then try to auto complete global argument names else if (context.TargetAction == null && context.TargetArgument == null) { return(globalArgumentSource.TryComplete(context, out completion)); } // if there is an action in context and not argument in context then try to complete action specific argument names and then globals else if (context.TargetAction != null && context.TargetArgument == null) { var actionSpecificSource = actionSpecificArgumentSources[context.TargetAction]; if (actionSpecificSource.TryComplete(context, out completion)) { return(true); } else { return(globalArgumentSource.TryComplete(context, out completion)); } } else { completion = null; return(false); } }
public bool TryComplete(TabCompletionContext context, out string completion) { if (context.TargetArgument != target) { completion = null; return(false); } return(wrappedSource.TryComplete(context, out completion)); }
public override bool TryComplete(bool shift, CommandLineArgument context, string soFar, out string completion) { return(wrappedSource.TryComplete(shift, soFar, out completion)); }