/// <summary> /// Callback on the command line text ready. /// We execute a custom (immediate) command which can be either a direct git /// command or a shell (command prompt?) command. /// Several commands may be separated by "&&" token. This accomodates Gerrit /// code review process and its shortcuts that can be easily pasted. /// </summary> private void CmdBoxTextReady(object sender, string cmd) { foreach (string command in cmd.Split(new[] { " && " }, StringSplitOptions.RemoveEmptyEntries)) { // Print out the command itself App.PrintStatusMessage(command, MessageType.Command); // If the command text started with a command 'git', remove it string[] tokens = command.Split(' '); string args = String.Join(" ", tokens, 1, tokens.Count() - 1); // We are guaranteed to have at least one token (by the TextBoxEx control) string run; if (tokens[0].ToLower() == "git") { // Command is a git command: execute it run = ClassGit.Run(args).ToString(); } else { // Command is an arbitrary (command line type) command // Use the command shell to execute it run = ClassUtils.ExecuteShellCommand(tokens[0], args); } App.PrintStatusMessage(run, MessageType.Output); } }