io/ipchandler: add prop get

This commit is contained in:
outfoxxed 2025-01-26 03:57:07 -08:00
parent 9417d6fa57
commit 4f2610dece
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
10 changed files with 262 additions and 31 deletions

View file

@ -293,6 +293,8 @@ int ipcCommand(CommandState& cmd) {
return IpcClient::connect(instance.instance.instanceId, [&](IpcClient& client) {
if (*cmd.ipc.show || cmd.ipc.showOld) {
return qs::io::ipc::comm::queryMetadata(&client, *cmd.ipc.target, *cmd.ipc.name);
} else if (*cmd.ipc.getprop) {
return qs::io::ipc::comm::getProperty(&client, *cmd.ipc.target, *cmd.ipc.name);
} else {
QVector<QString> arguments;
for (auto& arg: cmd.ipc.arguments) {

View file

@ -71,6 +71,7 @@ struct CommandState {
CLI::App* ipc = nullptr;
CLI::App* show = nullptr;
CLI::App* call = nullptr;
CLI::App* getprop = nullptr;
bool showOld = false;
QStringOption target;
QStringOption name;

View file

@ -194,6 +194,18 @@ int parseCommand(int argc, char** argv, CommandState& state) {
->description("Arguments to the called function.")
->allow_extra_args();
}
{
auto* prop =
sub->add_subcommand("prop", "Manipulate IpcHandler properties.")->require_subcommand();
{
auto* get = prop->add_subcommand("get", "Read the value of a property.");
state.ipc.getprop = get;
get->add_option("target", state.ipc.target, "The target to read the property of.");
get->add_option("property", state.ipc.name)->description("The property to read.");
}
}
}
{