fix: --pl subcommand not working correctly anymore
This commit is contained in:
parent
d45dd45720
commit
53fc018ada
@ -15,11 +15,17 @@ struct ImGuiContext;
|
|||||||
namespace hex {
|
namespace hex {
|
||||||
|
|
||||||
struct SubCommand {
|
struct SubCommand {
|
||||||
|
enum class Type : u8 {
|
||||||
|
Option,
|
||||||
|
SubCommand
|
||||||
|
};
|
||||||
|
|
||||||
std::string commandLong;
|
std::string commandLong;
|
||||||
std::string commandShort;
|
std::string commandShort;
|
||||||
|
|
||||||
std::string commandDescription;
|
std::string commandDescription;
|
||||||
std::function<void(const std::vector<std::string>&)> callback;
|
std::function<void(const std::vector<std::string>&)> callback;
|
||||||
|
Type type = Type::Option;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Feature {
|
struct Feature {
|
||||||
|
@ -53,7 +53,7 @@ namespace hex::subcommands {
|
|||||||
while (argsIter != args.end()) {
|
while (argsIter != args.end()) {
|
||||||
const std::string &arg = *argsIter;
|
const std::string &arg = *argsIter;
|
||||||
|
|
||||||
if (!currentSubCommandArgs.empty() && arg.starts_with("--")) {
|
if (!currentSubCommandArgs.empty() && arg.starts_with("--") && !(currentSubCommand.has_value() && currentSubCommand->type == SubCommand::Type::SubCommand)) {
|
||||||
// Save command to run
|
// Save command to run
|
||||||
if (currentSubCommand) {
|
if (currentSubCommand) {
|
||||||
subCommands.emplace_back(*currentSubCommand, currentSubCommandArgs);
|
subCommands.emplace_back(*currentSubCommand, currentSubCommandArgs);
|
||||||
|
@ -76,7 +76,7 @@ IMHEX_PLUGIN_SUBCOMMANDS() {
|
|||||||
{ "encode", "", "Encode a string", hex::plugin::builtin::handleEncodeCommand },
|
{ "encode", "", "Encode a string", hex::plugin::builtin::handleEncodeCommand },
|
||||||
{ "decode", "", "Decode a string", hex::plugin::builtin::handleDecodeCommand },
|
{ "decode", "", "Decode a string", hex::plugin::builtin::handleDecodeCommand },
|
||||||
{ "magic", "", "Identify file types", hex::plugin::builtin::handleMagicCommand },
|
{ "magic", "", "Identify file types", hex::plugin::builtin::handleMagicCommand },
|
||||||
{ "pl", "", "Interact with the pattern language", hex::plugin::builtin::handlePatternLanguageCommand },
|
{ "pl", "", "Interact with the pattern language", hex::plugin::builtin::handlePatternLanguageCommand, SubCommand::Type::SubCommand },
|
||||||
{ "hexdump", "", "Generate a hex dump of the provided file", hex::plugin::builtin::handleHexdumpCommand },
|
{ "hexdump", "", "Generate a hex dump of the provided file", hex::plugin::builtin::handleHexdumpCommand },
|
||||||
{ "demangle", "", "Demangle a mangled symbol", hex::plugin::builtin::handleDemangleCommand },
|
{ "demangle", "", "Demangle a mangled symbol", hex::plugin::builtin::handleDemangleCommand },
|
||||||
{ "reset-settings", "", "Resets all settings back to default", hex::plugin::builtin::handleSettingsResetCommand },
|
{ "reset-settings", "", "Resets all settings back to default", hex::plugin::builtin::handleSettingsResetCommand },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user