- // Look up the command and execute it.
- getCommand(Command)->runCommand(*this, Arguments);
+ CLICommand *CurCommand;
+
+ if (Command == "") {
+ CurCommand = LastCommand;
+ Arguments = LastArgs;
+ } else {
+ CurCommand = getCommand(Command);
+ }
+
+ // Save the command we are running in case the user wants us to repeat it
+ // next time.
+ LastCommand = CurCommand;
+ LastArgs = Arguments;
+
+ // Finally, execute the command.
+ if (CurCommand)
+ CurCommand->runCommand(*this, Arguments);