mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 07:47:03 -05:00
feat: Added short forms for commonly used commands
This commit is contained in:
@@ -47,16 +47,30 @@ namespace hex::plugin::builtin {
|
||||
"Available subcommands:\n"
|
||||
);
|
||||
|
||||
size_t longestCommand = 0;
|
||||
size_t longestLongCommand = 0, longestShortCommand = 0;
|
||||
for (const auto &plugin : PluginManager::getPlugins()) {
|
||||
for (const auto &subCommand : plugin.getSubCommands()) {
|
||||
longestCommand = std::max(longestCommand, subCommand.commandKey.size());
|
||||
longestLongCommand = std::max(longestLongCommand, subCommand.commandLong.size());
|
||||
longestShortCommand = std::max(longestShortCommand, subCommand.commandShort.size());
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto &plugin : PluginManager::getPlugins()) {
|
||||
for (const auto &subCommand : plugin.getSubCommands()) {
|
||||
hex::log::println(" --{}{: <{}} {}", subCommand.commandKey, "", longestCommand - subCommand.commandKey.size(), subCommand.commandDesc);
|
||||
hex::log::println(" "
|
||||
"{}"
|
||||
"{: <{}}"
|
||||
"{}"
|
||||
"{}"
|
||||
"{: <{}}"
|
||||
"{}",
|
||||
subCommand.commandShort.empty() ? " " : "-",
|
||||
subCommand.commandShort, longestShortCommand,
|
||||
subCommand.commandShort.empty() ? " " : ", ",
|
||||
subCommand.commandLong.empty() ? " " : "--",
|
||||
subCommand.commandLong, longestLongCommand + 5,
|
||||
subCommand.commandDescription
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user