2023-07-13 14:08:23 +02:00
|
|
|
#pragma once
|
|
|
|
|
2023-11-10 20:47:08 +01:00
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
#include <functional>
|
2023-07-13 14:08:23 +02:00
|
|
|
|
|
|
|
namespace hex::subcommands {
|
2023-11-10 20:47:08 +01:00
|
|
|
|
2023-07-13 14:08:23 +02:00
|
|
|
/**
|
|
|
|
* @brief Internal method - takes all the arguments ImHex received from the command line,
|
|
|
|
* and determine which subcommands to run, with which arguments.
|
|
|
|
* In some cases, the subcommand or this function directly might exit the program
|
|
|
|
* (e.g. --help, or when forwarding providers to open to another instance)
|
|
|
|
* and so this function might not return
|
|
|
|
*/
|
|
|
|
void processArguments(const std::vector<std::string> &args);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Forward the given command to the main instance (might be this instance)
|
|
|
|
* The callback will be executed after EventImHexStartupFinished
|
|
|
|
*/
|
|
|
|
void forwardSubCommand(const std::string &cmdName, const std::vector<std::string> &args);
|
|
|
|
|
|
|
|
using ForwardCommandHandler = std::function<void(const std::vector<std::string> &)>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Register the handler for this specific command name
|
|
|
|
*/
|
|
|
|
void registerSubCommand(const std::string &cmdName, const ForwardCommandHandler &handler);
|
2023-11-10 20:47:08 +01:00
|
|
|
|
2023-07-13 14:08:23 +02:00
|
|
|
}
|