void CmdMacro::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; if (client.argCount() == 0) { help(client); return; } if (client.arg(1, "start")) { client.startMacro(client.argValue(2)); } else if (client.arg(1, "end")) { client.endMacro(); } else if (client.arg(1, "replay")) { if (!client.playMacro(client.argValue(2))) { client.error("Unable to find specified macro."); processList(client); } } else if (client.arg(1, "list")) { processList(client); } else if (client.arg(1, "clear")) { string snum = client.argValue(2); if (!DebuggerClient::IsValidNumber(snum)) { client.error("'& [c]lear' needs an {index} argument."); client.tutorial( "You will have to run '& [l]ist' first to see a list of valid " "numbers or indices to specify." ); return; } int num = atoi(snum.c_str()); if (!client.deleteMacro(num)) { client.error("\"%s\" is not a valid macro index. Choose one from " "this list:", snum.c_str()); processList(client); return; } } }