添加close file。

This commit is contained in:
unlockable
2023-06-24 12:47:19 +08:00
parent 1e9533fb91
commit debd40d546

View File

@@ -92,7 +92,8 @@ bool StudentInfoManager::promptForFileName() {
if (tempFile.exists() && tempFile.is_regular_file()) {
int backSpaceCount = 0;
bool overWrite = false;
std::cout << "The file already exists. Replace? (y / n): "
std::cout << "The file " << tempFile.path()
<< " already exists. Replace? (y / n): "
<< std::flush;
std::cout << "no" << std::flush;
@@ -755,6 +756,8 @@ void StudentInfoManager::displayHelp() {
std::cout << "Next Page (j)\n";
std::cout << "Previous Page (k)\n";
std::cout << "Show (h)elp\n";
std::cout << "(W)rite to disk\n";
std::cout << "(C)lose file\n";
std::cout << "(Q)uit" << resetOutputColor << std::endl;
waitForAnyInput();
}
@@ -851,6 +854,11 @@ void StudentInfoManager::mainloop() {
backSpaceCount = 13;
cmd = infoManagerCommand::home::saveFile;
}
else if (commandLetter == 'c') {
std::cout << "Close file" << std::flush;
backSpaceCount = 10;
cmd = infoManagerCommand::home::closeFile;
}
else if (commandLetter == 'q') {
std::cout << "Quit" << std::flush;
backSpaceCount = 4;