public static ICommand AddStuffCmds(ICommandContext commandContext, ILogger logger, ICommandLine commandLine) { if (commandContext == null) { throw new ArgumentNullException(nameof(commandContext)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (commandLine == null) { throw new ArgumentNullException(nameof(commandLine)); } return(commandContext.RegisterCommand(new CommandInfo("stuffcmds", arguments => { if (arguments.Count > 0) { logger.Information("stuffcmds : execute command line parameters"); return; } var cmdIndex = 0; for (var i = 0; i < commandLine.Count - 1; ++i) { var key = commandLine[i]; if (key.StartsWith("+")) { //Grab all arguments until the next key var values = commandLine.GetValues(key); commandContext.InsertCommands($"{key.Substring(1)} {string.Join(' ', values)}", cmdIndex++); i += values.Count; } } }) .WithHelpInfo("Stuffs all command line arguments that contain commands into the command queue"))); }