mirror of
https://github.com/Leonmmcoset/CMLeonOS.git
synced 2026-03-03 15:30:27 +00:00
修复help命令
This commit is contained in:
@@ -1 +1 @@
|
|||||||
2026-02-27 22:33:00
|
2026-02-27 22:39:48
|
||||||
@@ -1 +1 @@
|
|||||||
fefb7e7
|
b67e0e7
|
||||||
@@ -403,7 +403,7 @@ namespace CMLeonOS.Commands
|
|||||||
{
|
{
|
||||||
Command = "help",
|
Command = "help",
|
||||||
Parameters = "<page>",
|
Parameters = "<page>",
|
||||||
Description = "Show help page (1-3)",
|
Description = "Show help page (1-4)",
|
||||||
SubCommands = new[] { new SubCommandInfo { Command = "help all", Description = "Show all help pages" } }
|
SubCommands = new[] { new SubCommandInfo { Command = "help all", Description = "Show all help pages" } }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -483,24 +483,32 @@ namespace CMLeonOS.Commands
|
|||||||
pageNumber = 1;
|
pageNumber = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int startIndex = (pageNumber - 1) * CommandsPerPage;
|
|
||||||
int endIndex = Math.Min(startIndex + CommandsPerPage, allCommands.Count);
|
|
||||||
|
|
||||||
Console.WriteLine("====================================");
|
Console.WriteLine("====================================");
|
||||||
Console.WriteLine($" Help - Page {pageNumber}/{totalPages}");
|
Console.WriteLine($" Help - Page {pageNumber}/{totalPages}");
|
||||||
Console.WriteLine("====================================");
|
Console.WriteLine("====================================");
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
|
|
||||||
int linesOnPage = 0;
|
int linesOnPage = 0;
|
||||||
for (int i = startIndex; i < endIndex; i++)
|
int currentLine = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < allCommands.Count; i++)
|
||||||
{
|
{
|
||||||
int cmdLines = GetCommandLinesCount(allCommands[i]);
|
int cmdLines = GetCommandLinesCount(allCommands[i]);
|
||||||
if (linesOnPage + cmdLines > CommandsPerPage)
|
|
||||||
|
if (currentLine + cmdLines <= (pageNumber - 1) * CommandsPerPage)
|
||||||
|
{
|
||||||
|
currentLine += cmdLines;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (linesOnPage >= CommandsPerPage)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayCommand(allCommands[i]);
|
DisplayCommand(allCommands[i]);
|
||||||
linesOnPage += cmdLines;
|
linesOnPage += cmdLines;
|
||||||
|
currentLine += cmdLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pageNumber < totalPages)
|
if (pageNumber < totalPages)
|
||||||
|
|||||||
Reference in New Issue
Block a user