private static bool IsBool(string key, CommandLineArgumentsDefinition definition, ParseResult resultContext)
{
var match = definition.FindMatchingArgument(key, true);
if (match == null)
{
var possibleActionContext = resultContext.ImplicitParameters.ContainsKey(0) ? resultContext.ImplicitParameters[0] : null;
if (possibleActionContext == null)
{
return(false);
}
else
{
var actionContext = definition.FindMatchingAction(possibleActionContext, true);
if (actionContext == null)
{
return(false);
}
match = actionContext.FindMatchingArgument(key, true);
if (match == null)
{
return(false);
}
}
}
return(match.ArgumentType == typeof(bool));
}