1
0
mirror of synced 2024-12-05 04:27:56 +01:00
ImHex/lib/libimhex/include/hex/subcommands/subcommands.hpp
iTrooz 1ed658bcdc
feat: Added command line interface support (#1172)
System design has been discussed on discord

Should fix #948

---------

Co-authored-by: WerWolv <werwolv98@gmail.com>
2023-07-13 14:08:23 +02:00

31 lines
1.1 KiB
C++

#pragma once
#include<vector>
#include<string>
#include<functional>
namespace hex::subcommands {
/**
* @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);
}