public bool TryRewrite(Dictionary <string, object> context) { if (!ContextHelper.TryGetOptions(context, out var options)) { return(false); } if (!options.Any(IsHelpOption)) { return(false); } if (ContextHelper.TryGetCommandName(context, out var commandNameParts) && commandNameParts.Length > 0) { if (_commandResolver.TryResolve(context, _appModel.Commands, out var command) && command.Arguments.Any(IsHelpOption)) { return(false); } var commandName = new CommandName(commandNameParts); ContextHelper.SetOperands(context, new[] { commandName.ToString() }); } else { // General help ContextHelper.SetOperands(context, ContextHelper.EmptyOperands); } ContextHelper.SetCommandName(context, new[] { "help" }); ContextHelper.SetOptions(context, ContextHelper.EmptyOptions); return(true); }